summaryrefslogtreecommitdiffstats
path: root/Tools/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-12 08:10:47 (GMT)
committerGitHub <noreply@github.com>2017-03-12 08:10:47 (GMT)
commit202fda55c2dffe27125703225e5af92254602dc6 (patch)
treeafc430d7fa6bdda7251bb60703ff192b9c8a37e1 /Tools/clinic
parent0767ad40bfe83525d2ba290cc6eb7c97ce01cdd6 (diff)
downloadcpython-202fda55c2dffe27125703225e5af92254602dc6.zip
cpython-202fda55c2dffe27125703225e5af92254602dc6.tar.gz
cpython-202fda55c2dffe27125703225e5af92254602dc6.tar.bz2
bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-xTools/clinic/clinic.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 6c65310..3d51c1d 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -2546,7 +2546,11 @@ class bool_converter(CConverter):
format_unit = 'p'
c_ignored_default = '0'
- def converter_init(self):
+ def converter_init(self, *, accept={object}):
+ if accept == {int}:
+ self.format_unit = 'i'
+ elif accept != {object}:
+ fail("bool_converter: illegal 'accept' argument " + repr(accept))
if self.default is not unspecified:
self.default = bool(self.default)
self.c_default = str(int(self.default))