]> granicus.if.org Git - python/commitdiff
Issue #20299: Argument Clinic custom converters may now change the default
authorLarry Hastings <larry@hastings.org>
Sun, 19 Jan 2014 05:54:15 +0000 (21:54 -0800)
committerLarry Hastings <larry@hastings.org>
Sun, 19 Jan 2014 05:54:15 +0000 (21:54 -0800)
value of c_default and py_default with a class member.

Misc/NEWS
Tools/clinic/clinic.py

index b97f4f8cd25c7c3ebac8b625fa37706394206380..b66ae0b8a40216604c8549262458116a2b4e019e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -101,6 +101,9 @@ Tests
 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.
 
index 0987d568bd6520771f0549dc0b8bd963ae70abcf..ba0bc174ce2116e45691a66a16871e362cd73d12 100755 (executable)
@@ -1893,8 +1893,10 @@ class CConverter(metaclass=CConverterAutoRegister):
                     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.")