]> granicus.if.org Git - python/commitdiff
inspect.Signature.from_function: Use CO_VARARGS & CO_VARKEYWORDS constants
authorYury Selivanov <yselivanov@sprymix.com>
Wed, 29 Jan 2014 21:50:40 +0000 (16:50 -0500)
committerYury Selivanov <yselivanov@sprymix.com>
Wed, 29 Jan 2014 21:50:40 +0000 (16:50 -0500)
Lib/inspect.py

index 3ad4a825dc685166acaab1248a401cc50d5368d7..e6c7b5b634ef2c0a759c675793647c6ba1090238 100644 (file)
@@ -2109,7 +2109,7 @@ class Signature:
                                         default=defaults[offset]))
 
         # *args
-        if func_code.co_flags & 0x04:
+        if func_code.co_flags & CO_VARARGS:
             name = arg_names[pos_count + keyword_only_count]
             annotation = annotations.get(name, _empty)
             parameters.append(Parameter(name, annotation=annotation,
@@ -2126,9 +2126,9 @@ class Signature:
                                         kind=_KEYWORD_ONLY,
                                         default=default))
         # **kwargs
-        if func_code.co_flags & 0x08:
+        if func_code.co_flags & CO_VARKEYWORDS:
             index = pos_count + keyword_only_count
-            if func_code.co_flags & 0x04:
+            if func_code.co_flags & CO_VARARGS:
                 index += 1
 
             name = arg_names[index]