mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-24037: Add Argument Clinic converter bool(accept={int})
. (#485)
This commit is contained in:
parent
0767ad40bf
commit
202fda55c2
17 changed files with 81 additions and 73 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue