[Python-checkins] cpython: inspect.Signature.from_function: Use CO_VARARGS & CO_VARKEYWORDS constants

yury.selivanov python-checkins at python.org
Wed Jan 29 22:50:50 CET 2014


http://hg.python.org/cpython/rev/1435ebd8b88e
changeset:   88818:1435ebd8b88e
parent:      88816:e508c2b8fd44
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Wed Jan 29 16:50:40 2014 -0500
summary:
  inspect.Signature.from_function: Use CO_VARARGS & CO_VARKEYWORDS constants

files:
  Lib/inspect.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/inspect.py b/Lib/inspect.py
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2109,7 +2109,7 @@
                                         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 @@
                                         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]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list