mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +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
6
Objects/clinic/unicodeobject.c.h
generated
6
Objects/clinic/unicodeobject.c.h
generated
|
@ -1193,8 +1193,8 @@ unicode_splitlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
keepends = _PyLong_AsInt(args[0]);
|
||||
if (keepends == -1 && PyErr_Occurred()) {
|
||||
keepends = PyObject_IsTrue(args[0]);
|
||||
if (keepends < 0) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
|
@ -1497,4 +1497,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=e775ff4154f1c935 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=05d942840635dadf input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue