diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-12 08:10:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-12 08:10:47 (GMT) |
commit | 202fda55c2dffe27125703225e5af92254602dc6 (patch) | |
tree | afc430d7fa6bdda7251bb60703ff192b9c8a37e1 /Tools/clinic | |
parent | 0767ad40bfe83525d2ba290cc6eb7c97ce01cdd6 (diff) | |
download | cpython-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-x | Tools/clinic/clinic.py | 6 |
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)) |