bpo-24037: Add Argument Clinic converter bool(accept={int}). (#485)

This commit is contained in:
Serhiy Storchaka 2017-03-12 10:10:47 +02:00 committed by GitHub
parent 0767ad40bf
commit 202fda55c2
17 changed files with 81 additions and 73 deletions

View file

@ -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))