Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b470575

Browse files
committed
Issue #20299: Argument Clinic custom converters may now change the default
value of c_default and py_default with a class member.
1 parent dc3cce0 commit b470575

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ Tests
101101
Tools/Demos
102102
-----------
103103

104+
- Issue #20299: Argument Clinic custom converters may now change the default
105+
value of c_default and py_default with a class member.
106+
104107
- Issue #20287: Argument Clinic's output is now configurable, allowing
105108
delaying its output or even redirecting it to a separate file.
106109

Tools/clinic/clinic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,8 +1893,10 @@ def __init__(self, name, function, default=unspecified, *, c_default=None, py_de
18931893
self.__class__.__name__, default, name, types_str))
18941894
self.default = default
18951895

1896-
self.c_default = c_default
1897-
self.py_default = py_default
1896+
if c_default:
1897+
self.c_default = c_default
1898+
if py_default:
1899+
self.py_default = py_default
18981900

18991901
if annotation != unspecified:
19001902
fail("The 'annotation' parameter is not currently permitted.")

0 commit comments

Comments
 (0)