mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-15999: Accept arbitrary values for boolean parameters. (#15609)
builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
This commit is contained in:
parent
c68573b339
commit
a87c46eab3
52 changed files with 297 additions and 302 deletions
|
@ -667,7 +667,7 @@ profiler_enable(ProfilerObject *self, PyObject *args, PyObject *kwds)
|
|||
int subcalls = -1;
|
||||
int builtins = -1;
|
||||
static char *kwlist[] = {"subcalls", "builtins", 0};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ii:enable",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|pp:enable",
|
||||
kwlist, &subcalls, &builtins))
|
||||
return NULL;
|
||||
if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtins) < 0) {
|
||||
|
@ -770,7 +770,7 @@ profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw)
|
|||
static char *kwlist[] = {"timer", "timeunit",
|
||||
"subcalls", "builtins", 0};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odii:Profiler", kwlist,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odpp:Profiler", kwlist,
|
||||
&timer, &timeunit,
|
||||
&subcalls, &builtins))
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue