[Python-checkins] cpython: Issue #20299: Argument Clinic custom converters may now change the default

larry.hastings python-checkins at python.org
Sun Jan 19 06:54:38 CET 2014


http://hg.python.org/cpython/rev/8f11493cf727
changeset:   88569:8f11493cf727
user:        Larry Hastings <larry at hastings.org>
date:        Sat Jan 18 21:54:15 2014 -0800
summary:
  Issue #20299: Argument Clinic custom converters may now change the default
value of c_default and py_default with a class member.

files:
  Misc/NEWS              |  3 +++
  Tools/clinic/clinic.py |  6 ++++--
  2 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -101,6 +101,9 @@
 Tools/Demos
 -----------
 
+- Issue #20299: Argument Clinic custom converters may now change the default
+  value of c_default and py_default with a class member.
+
 - Issue #20287: Argument Clinic's output is now configurable, allowing
   delaying its output or even redirecting it to a separate file.
 
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -1893,8 +1893,10 @@
                     self.__class__.__name__, default, name, types_str))
             self.default = default
 
-        self.c_default = c_default
-        self.py_default = py_default
+        if c_default:
+            self.c_default = c_default
+        if py_default:
+            self.py_default = py_default
 
         if annotation != unspecified:
             fail("The 'annotation' parameter is not currently permitted.")

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


More information about the Python-checkins mailing list