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:
Serhiy Storchaka 2022-12-03 21:52:21 +02:00 committed by GitHub
parent c68573b339
commit a87c46eab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 297 additions and 302 deletions

View File

@ -178,6 +178,10 @@ Other Language Changes
In a future Python version they will be eventually a :exc:`SyntaxError`. In a future Python version they will be eventually a :exc:`SyntaxError`.
(Contributed by Victor Stinner in :gh:`98401`.) (Contributed by Victor Stinner in :gh:`98401`.)
* All builtin and extension callables expecting boolean parameters now accept
arguments of any type instead of just :class:`bool` and :class:`int`.
(Contributed by Serhiy Storchaka in :gh:`60203`.)
New Modules New Modules
=========== ===========

View File

@ -739,10 +739,6 @@ class TestBasicOps(unittest.TestCase):
c.__setstate__((tuple('defg'), 0)) c.__setstate__((tuple('defg'), 0))
take(20, c) take(20, c)
# The second argument in the setstate tuple must be an int
with self.assertRaises(TypeError):
cycle('defg').__setstate__((list('abcdefg'), 'x'))
self.assertRaises(TypeError, cycle('').__setstate__, ()) self.assertRaises(TypeError, cycle('').__setstate__, ())
self.assertRaises(TypeError, cycle('').__setstate__, ([],)) self.assertRaises(TypeError, cycle('').__setstate__, ([],))

View File

@ -1646,12 +1646,6 @@ class _PosixSpawnMixin:
) )
support.wait_process(pid, exitcode=0) support.wait_process(pid, exitcode=0)
def test_resetids_wrong_type(self):
with self.assertRaises(TypeError):
self.spawn_func(sys.executable,
[sys.executable, "-c", "pass"],
os.environ, resetids=None)
def test_setpgroup(self): def test_setpgroup(self):
pid = self.spawn_func( pid = self.spawn_func(
sys.executable, sys.executable,

View File

@ -0,0 +1,2 @@
All built-in functions now accept arguments of any type instead of just
``bool`` and ``int`` for boolean parameters.

View File

@ -256,14 +256,14 @@ _codecs_escape_encode_impl(PyObject *module, PyObject *data,
_codecs.utf_7_decode _codecs.utf_7_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=0cd3a944a32a4089 input=22c395d357815d26]*/ /*[clinic end generated code: output=0cd3a944a32a4089 input=dbf8c8998102dc7d]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeUTF7Stateful(data->buf, data->len, PyObject *decoded = PyUnicode_DecodeUTF7Stateful(data->buf, data->len,
@ -276,14 +276,14 @@ _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_8_decode _codecs.utf_8_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=10f74dec8d9bb8bf input=f611b3867352ba59]*/ /*[clinic end generated code: output=10f74dec8d9bb8bf input=ca06bc8a9c970e25]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeUTF8Stateful(data->buf, data->len, PyObject *decoded = PyUnicode_DecodeUTF8Stateful(data->buf, data->len,
@ -296,14 +296,14 @@ _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_16_decode _codecs.utf_16_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=783b442abcbcc2d0 input=191d360bd7309180]*/ /*[clinic end generated code: output=783b442abcbcc2d0 input=5b0f52071ba6cadc]*/
{ {
int byteorder = 0; int byteorder = 0;
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
@ -318,14 +318,14 @@ _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_16_le_decode _codecs.utf_16_le_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=899b9e6364379dcd input=c6904fdc27fb4724]*/ /*[clinic end generated code: output=899b9e6364379dcd input=115bd8c7b783d0bf]*/
{ {
int byteorder = -1; int byteorder = -1;
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
@ -340,14 +340,14 @@ _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_16_be_decode _codecs.utf_16_be_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=49f6465ea07669c8 input=e49012400974649b]*/ /*[clinic end generated code: output=49f6465ea07669c8 input=63131422b01f9cb4]*/
{ {
int byteorder = 1; int byteorder = 1;
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
@ -370,14 +370,14 @@ _codecs.utf_16_ex_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
byteorder: int = 0 byteorder: int = 0
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int byteorder, int final) const char *errors, int byteorder, int final)
/*[clinic end generated code: output=0f385f251ecc1988 input=5a9c19f2e6b6cf0e]*/ /*[clinic end generated code: output=0f385f251ecc1988 input=f368a51cf384bf4c]*/
{ {
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
@ -394,14 +394,14 @@ _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_32_decode _codecs.utf_32_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=2fc961807f7b145f input=fd7193965627eb58]*/ /*[clinic end generated code: output=2fc961807f7b145f input=fcdf3658c5e9b5f3]*/
{ {
int byteorder = 0; int byteorder = 0;
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
@ -416,14 +416,14 @@ _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_32_le_decode _codecs.utf_32_le_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=ec8f46b67a94f3e6 input=9078ec70acfe7613]*/ /*[clinic end generated code: output=ec8f46b67a94f3e6 input=12220556e885f817]*/
{ {
int byteorder = -1; int byteorder = -1;
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
@ -438,14 +438,14 @@ _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
_codecs.utf_32_be_decode _codecs.utf_32_be_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=ff82bae862c92c4e input=f1ae1bbbb86648ff]*/ /*[clinic end generated code: output=ff82bae862c92c4e input=2bc669b4781598db]*/
{ {
int byteorder = 1; int byteorder = 1;
/* This is overwritten unless final is true. */ /* This is overwritten unless final is true. */
@ -468,14 +468,14 @@ _codecs.utf_32_ex_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
byteorder: int = 0 byteorder: int = 0
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data, _codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int byteorder, int final) const char *errors, int byteorder, int final)
/*[clinic end generated code: output=6bfb177dceaf4848 input=e46a73bc859d0bd0]*/ /*[clinic end generated code: output=6bfb177dceaf4848 input=4a2323d0013620df]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeUTF32Stateful(data->buf, data->len, PyObject *decoded = PyUnicode_DecodeUTF32Stateful(data->buf, data->len,
@ -490,14 +490,14 @@ _codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
_codecs.unicode_escape_decode _codecs.unicode_escape_decode
data: Py_buffer(accept={str, buffer}) data: Py_buffer(accept={str, buffer})
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = True final: bool = True
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data, _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=b284f97b12c635ee input=6154f039a9f7c639]*/ /*[clinic end generated code: output=b284f97b12c635ee input=15019f081ffe272b]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = _PyUnicode_DecodeUnicodeEscapeStateful(data->buf, data->len, PyObject *decoded = _PyUnicode_DecodeUnicodeEscapeStateful(data->buf, data->len,
@ -510,14 +510,14 @@ _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
_codecs.raw_unicode_escape_decode _codecs.raw_unicode_escape_decode
data: Py_buffer(accept={str, buffer}) data: Py_buffer(accept={str, buffer})
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = True final: bool = True
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data, _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=11dbd96301e2879e input=2d166191beb3235a]*/ /*[clinic end generated code: output=11dbd96301e2879e input=b93f823aa8c343ad]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = _PyUnicode_DecodeRawUnicodeEscapeStateful(data->buf, data->len, PyObject *decoded = _PyUnicode_DecodeRawUnicodeEscapeStateful(data->buf, data->len,
@ -586,14 +586,14 @@ _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data,
_codecs.mbcs_decode _codecs.mbcs_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data, _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=39b65b8598938c4b input=1c1d50f08fa53789]*/ /*[clinic end generated code: output=39b65b8598938c4b input=f144ad1ed6d8f5a6]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeMBCSStateful(data->buf, data->len, PyObject *decoded = PyUnicode_DecodeMBCSStateful(data->buf, data->len,
@ -605,14 +605,14 @@ _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
_codecs.oem_decode _codecs.oem_decode
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_oem_decode_impl(PyObject *module, Py_buffer *data, _codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final) const char *errors, int final)
/*[clinic end generated code: output=da1617612f3fcad8 input=81b67cba811022e5]*/ /*[clinic end generated code: output=da1617612f3fcad8 input=629bf87376d211b4]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeCodePageStateful(CP_OEMCP, PyObject *decoded = PyUnicode_DecodeCodePageStateful(CP_OEMCP,
@ -625,14 +625,14 @@ _codecs.code_page_decode
codepage: int codepage: int
data: Py_buffer data: Py_buffer
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
final: bool(accept={int}) = False final: bool = False
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_codecs_code_page_decode_impl(PyObject *module, int codepage, _codecs_code_page_decode_impl(PyObject *module, int codepage,
Py_buffer *data, const char *errors, int final) Py_buffer *data, const char *errors, int final)
/*[clinic end generated code: output=53008ea967da3fff input=c5f58d036cb63575]*/ /*[clinic end generated code: output=53008ea967da3fff input=6a32589b0658c277]*/
{ {
Py_ssize_t consumed = data->len; Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeCodePageStateful(codepage, PyObject *decoded = PyUnicode_DecodeCodePageStateful(codepage,

View File

@ -2371,7 +2371,7 @@ _curses.window.touchline
start: int start: int
count: int count: int
[ [
changed: bool(accept={int}) = True changed: bool = True
] ]
/ /
@ -2384,7 +2384,7 @@ as having been changed (changed=True) or unchanged (changed=False).
static PyObject * static PyObject *
_curses_window_touchline_impl(PyCursesWindowObject *self, int start, _curses_window_touchline_impl(PyCursesWindowObject *self, int start,
int count, int group_right_1, int changed) int count, int group_right_1, int changed)
/*[clinic end generated code: output=65d05b3f7438c61d input=918ad1cbdadf93ea]*/ /*[clinic end generated code: output=65d05b3f7438c61d input=a98aa4f79b6be845]*/
{ {
if (!group_right_1) { if (!group_right_1) {
return PyCursesCheckERR(touchline(self->win, start, count), "touchline"); return PyCursesCheckERR(touchline(self->win, start, count), "touchline");
@ -2706,7 +2706,7 @@ NoArgTrueFalseFunctionBody(can_change_color)
/*[clinic input] /*[clinic input]
_curses.cbreak _curses.cbreak
flag: bool(accept={int}) = True flag: bool = True
If false, the effect is the same as calling nocbreak(). If false, the effect is the same as calling nocbreak().
/ /
@ -2721,7 +2721,7 @@ Calling first raw() then cbreak() leaves the terminal in cbreak mode.
static PyObject * static PyObject *
_curses_cbreak_impl(PyObject *module, int flag) _curses_cbreak_impl(PyObject *module, int flag)
/*[clinic end generated code: output=9f9dee9664769751 input=150be619eb1f1458]*/ /*[clinic end generated code: output=9f9dee9664769751 input=c7d0bddda93016c1]*/
NoArgOrFlagNoReturnFunctionBody(cbreak, flag) NoArgOrFlagNoReturnFunctionBody(cbreak, flag)
/*[clinic input] /*[clinic input]
@ -2870,7 +2870,7 @@ NoArgNoReturnFunctionBody(doupdate)
/*[clinic input] /*[clinic input]
_curses.echo _curses.echo
flag: bool(accept={int}) = True flag: bool = True
If false, the effect is the same as calling noecho(). If false, the effect is the same as calling noecho().
/ /
@ -2881,7 +2881,7 @@ In echo mode, each character input is echoed to the screen as it is entered.
static PyObject * static PyObject *
_curses_echo_impl(PyObject *module, int flag) _curses_echo_impl(PyObject *module, int flag)
/*[clinic end generated code: output=03acb2ddfa6c8729 input=2e9e891d637eac5d]*/ /*[clinic end generated code: output=03acb2ddfa6c8729 input=86cd4d5bb1d569c0]*/
NoArgOrFlagNoReturnFunctionBody(echo, flag) NoArgOrFlagNoReturnFunctionBody(echo, flag)
/*[clinic input] /*[clinic input]
@ -3496,14 +3496,14 @@ _curses_set_tabsize_impl(PyObject *module, int size)
/*[clinic input] /*[clinic input]
_curses.intrflush _curses.intrflush
flag: bool(accept={int}) flag: bool
/ /
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_curses_intrflush_impl(PyObject *module, int flag) _curses_intrflush_impl(PyObject *module, int flag)
/*[clinic end generated code: output=c1986df35e999a0f input=fcba57bb28dfd795]*/ /*[clinic end generated code: output=c1986df35e999a0f input=c65fe2ef973fe40a]*/
{ {
PyCursesInitialised; PyCursesInitialised;
@ -3605,7 +3605,7 @@ NoArgReturnStringFunctionBody(longname)
/*[clinic input] /*[clinic input]
_curses.meta _curses.meta
yes: bool(accept={int}) yes: bool
/ /
Enable/disable meta keys. Enable/disable meta keys.
@ -3616,7 +3616,7 @@ allow only 7-bit characters.
static PyObject * static PyObject *
_curses_meta_impl(PyObject *module, int yes) _curses_meta_impl(PyObject *module, int yes)
/*[clinic end generated code: output=22f5abda46a605d8 input=af9892e3a74f35db]*/ /*[clinic end generated code: output=22f5abda46a605d8 input=cfe7da79f51d0e30]*/
{ {
PyCursesInitialised; PyCursesInitialised;
@ -3766,7 +3766,7 @@ _curses_newwin_impl(PyObject *module, int nlines, int ncols,
/*[clinic input] /*[clinic input]
_curses.nl _curses.nl
flag: bool(accept={int}) = True flag: bool = True
If false, the effect is the same as calling nonl(). If false, the effect is the same as calling nonl().
/ /
@ -3778,7 +3778,7 @@ newline into return and line-feed on output. Newline mode is initially on.
static PyObject * static PyObject *
_curses_nl_impl(PyObject *module, int flag) _curses_nl_impl(PyObject *module, int flag)
/*[clinic end generated code: output=b39cc0ffc9015003 input=cf36a63f7b86e28a]*/ /*[clinic end generated code: output=b39cc0ffc9015003 input=18e3e9c6e8cfcf6f]*/
NoArgOrFlagNoReturnFunctionBody(nl, flag) NoArgOrFlagNoReturnFunctionBody(nl, flag)
/*[clinic input] /*[clinic input]
@ -3925,7 +3925,7 @@ _curses_putp_impl(PyObject *module, const char *string)
/*[clinic input] /*[clinic input]
_curses.qiflush _curses.qiflush
flag: bool(accept={int}) = True flag: bool = True
If false, the effect is the same as calling noqiflush(). If false, the effect is the same as calling noqiflush().
/ /
@ -3937,7 +3937,7 @@ will be flushed when the INTR, QUIT and SUSP characters are read.
static PyObject * static PyObject *
_curses_qiflush_impl(PyObject *module, int flag) _curses_qiflush_impl(PyObject *module, int flag)
/*[clinic end generated code: output=9167e862f760ea30 input=e9e4a389946a0dbc]*/ /*[clinic end generated code: output=9167e862f760ea30 input=6ec8b3e2b717ec40]*/
{ {
PyCursesInitialised; PyCursesInitialised;
@ -4018,7 +4018,7 @@ _curses_update_lines_cols_impl(PyObject *module)
/*[clinic input] /*[clinic input]
_curses.raw _curses.raw
flag: bool(accept={int}) = True flag: bool = True
If false, the effect is the same as calling noraw(). If false, the effect is the same as calling noraw().
/ /
@ -4031,7 +4031,7 @@ curses input functions one by one.
static PyObject * static PyObject *
_curses_raw_impl(PyObject *module, int flag) _curses_raw_impl(PyObject *module, int flag)
/*[clinic end generated code: output=a750e4b342be015b input=e36d8db27832b848]*/ /*[clinic end generated code: output=a750e4b342be015b input=4b447701389fb4df]*/
NoArgOrFlagNoReturnFunctionBody(raw, flag) NoArgOrFlagNoReturnFunctionBody(raw, flag)
/*[clinic input] /*[clinic input]
@ -4503,7 +4503,7 @@ _curses_unget_wch(PyObject *module, PyObject *ch)
/*[clinic input] /*[clinic input]
_curses.use_env _curses.use_env
flag: bool(accept={int}) flag: bool
/ /
Use environment variables LINES and COLUMNS. Use environment variables LINES and COLUMNS.
@ -4520,7 +4520,7 @@ not set).
static PyObject * static PyObject *
_curses_use_env_impl(PyObject *module, int flag) _curses_use_env_impl(PyObject *module, int flag)
/*[clinic end generated code: output=b2c445e435c0b164 input=1778eb1e9151ea37]*/ /*[clinic end generated code: output=b2c445e435c0b164 input=06ac30948f2d78e4]*/
{ {
use_env(flag); use_env(flag);
Py_RETURN_NONE; Py_RETURN_NONE;

View File

@ -59,7 +59,7 @@ PyDoc_STRVAR(module_doc,
" I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n" " I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n"
" possible.\n" " possible.\n"
); );
/* /*
* The main open() function * The main open() function
@ -74,7 +74,7 @@ _io.open
encoding: str(accept={str, NoneType}) = None encoding: str(accept={str, NoneType}) = None
errors: str(accept={str, NoneType}) = None errors: str(accept={str, NoneType}) = None
newline: str(accept={str, NoneType}) = None newline: str(accept={str, NoneType}) = None
closefd: bool(accept={int}) = True closefd: bool = True
opener: object = None opener: object = None
Open file and return a stream. Raise OSError upon failure. Open file and return a stream. Raise OSError upon failure.
@ -196,7 +196,7 @@ static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode, _io_open_impl(PyObject *module, PyObject *file, const char *mode,
int buffering, const char *encoding, const char *errors, int buffering, const char *encoding, const char *errors,
const char *newline, int closefd, PyObject *opener) const char *newline, int closefd, PyObject *opener)
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=5bb37f174cb2fb11]*/ /*[clinic end generated code: output=aefafc4ce2b46dc0 input=cd034e7cdfbf4e78]*/
{ {
unsigned i; unsigned i;
@ -204,8 +204,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
int text = 0, binary = 0; int text = 0, binary = 0;
char rawmode[6], *m; char rawmode[6], *m;
int line_buffering, is_number; int line_buffering, is_number, isatty = 0;
long isatty = 0;
PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL, *path_or_fd = NULL; PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL, *path_or_fd = NULL;
@ -345,9 +344,9 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
PyObject *res = PyObject_CallMethodNoArgs(raw, &_Py_ID(isatty)); PyObject *res = PyObject_CallMethodNoArgs(raw, &_Py_ID(isatty));
if (res == NULL) if (res == NULL)
goto error; goto error;
isatty = PyLong_AsLong(res); isatty = PyObject_IsTrue(res);
Py_DECREF(res); Py_DECREF(res);
if (isatty == -1 && PyErr_Occurred()) if (isatty < 0)
goto error; goto error;
} }
@ -509,7 +508,7 @@ _io_open_code_impl(PyObject *module, PyObject *path)
{ {
return PyFile_OpenCodeObject(path); return PyFile_OpenCodeObject(path);
} }
/* /*
* Private helpers for the io module. * Private helpers for the io module.
*/ */

View File

@ -280,8 +280,8 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
} }
} }
if (args[6]) { if (args[6]) {
closefd = _PyLong_AsInt(args[6]); closefd = PyObject_IsTrue(args[6]);
if (closefd == -1 && PyErr_Occurred()) { if (closefd < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -407,4 +407,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=1f8001287a423470 input=a9049054013a1b77]*/ /*[clinic end generated code: output=f387eba3f4c0254a input=a9049054013a1b77]*/

View File

@ -116,8 +116,8 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[2]) { if (fastargs[2]) {
closefd = _PyLong_AsInt(fastargs[2]); closefd = PyObject_IsTrue(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) { if (closefd < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -466,4 +466,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF #ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF #define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */ #endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
/*[clinic end generated code: output=ff479a26cab0d479 input=a9049054013a1b77]*/ /*[clinic end generated code: output=27f883807a6c29ae input=a9049054013a1b77]*/

View File

@ -68,8 +68,8 @@ _io_IncrementalNewlineDecoder___init__(PyObject *self, PyObject *args, PyObject
goto exit; goto exit;
} }
decoder = fastargs[0]; decoder = fastargs[0];
translate = _PyLong_AsInt(fastargs[1]); translate = PyObject_IsTrue(fastargs[1]);
if (translate == -1 && PyErr_Occurred()) { if (translate < 0) {
goto exit; goto exit;
} }
if (!noptargs) { if (!noptargs) {
@ -137,8 +137,8 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject *const *ar
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
final = _PyLong_AsInt(args[1]); final = PyObject_IsTrue(args[1]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -331,16 +331,16 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[4]) { if (fastargs[4]) {
line_buffering = _PyLong_AsInt(fastargs[4]); line_buffering = PyObject_IsTrue(fastargs[4]);
if (line_buffering == -1 && PyErr_Occurred()) { if (line_buffering < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
write_through = _PyLong_AsInt(fastargs[5]); write_through = PyObject_IsTrue(fastargs[5]);
if (write_through == -1 && PyErr_Occurred()) { if (write_through < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -769,4 +769,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{ {
return _io_TextIOWrapper_close_impl(self); return _io_TextIOWrapper_close_impl(self);
} }
/*[clinic end generated code: output=aecd376eca3cb148 input=a9049054013a1b77]*/ /*[clinic end generated code: output=73f84b13c343b34b input=a9049054013a1b77]*/

View File

@ -115,8 +115,8 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[2]) { if (fastargs[2]) {
closefd = _PyLong_AsInt(fastargs[2]); closefd = PyObject_IsTrue(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) { if (closefd < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -407,4 +407,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF #ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */ #endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
/*[clinic end generated code: output=08ae244e9a44da55 input=a9049054013a1b77]*/ /*[clinic end generated code: output=4920e9068e0cf08a input=a9049054013a1b77]*/

View File

@ -198,7 +198,7 @@ extern int _Py_open_cloexec_works;
_io.FileIO.__init__ _io.FileIO.__init__
file as nameobj: object file as nameobj: object
mode: str = "r" mode: str = "r"
closefd: bool(accept={int}) = True closefd: bool = True
opener: object = None opener: object = None
Open a file. Open a file.
@ -219,7 +219,7 @@ results in functionality similar to passing None).
static int static int
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode, _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
int closefd, PyObject *opener) int closefd, PyObject *opener)
/*[clinic end generated code: output=23413f68e6484bbd input=1596c9157a042a39]*/ /*[clinic end generated code: output=23413f68e6484bbd input=588aac967e0ba74b]*/
{ {
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
Py_UNICODE *widename = NULL; Py_UNICODE *widename = NULL;

View File

@ -212,7 +212,7 @@ typedef struct {
/*[clinic input] /*[clinic input]
_io.IncrementalNewlineDecoder.__init__ _io.IncrementalNewlineDecoder.__init__
decoder: object decoder: object
translate: int translate: bool
errors: object(c_default="NULL") = "strict" errors: object(c_default="NULL") = "strict"
Codec used when reading a file in universal newlines mode. Codec used when reading a file in universal newlines mode.
@ -229,7 +229,7 @@ static int
_io_IncrementalNewlineDecoder___init___impl(nldecoder_object *self, _io_IncrementalNewlineDecoder___init___impl(nldecoder_object *self,
PyObject *decoder, int translate, PyObject *decoder, int translate,
PyObject *errors) PyObject *errors)
/*[clinic end generated code: output=fbd04d443e764ec2 input=89db6b19c6b126bf]*/ /*[clinic end generated code: output=fbd04d443e764ec2 input=ed547aa257616b0e]*/
{ {
if (errors == NULL) { if (errors == NULL) {
@ -484,13 +484,13 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
/*[clinic input] /*[clinic input]
_io.IncrementalNewlineDecoder.decode _io.IncrementalNewlineDecoder.decode
input: object input: object
final: bool(accept={int}) = False final: bool = False
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self, _io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
PyObject *input, int final) PyObject *input, int final)
/*[clinic end generated code: output=0d486755bb37a66e input=a4ea97f26372d866]*/ /*[clinic end generated code: output=0d486755bb37a66e input=90e223c70322c5cd]*/
{ {
return _PyIncrementalNewlineDecoder_decode((PyObject *) self, input, final); return _PyIncrementalNewlineDecoder_decode((PyObject *) self, input, final);
} }
@ -1023,8 +1023,8 @@ _io.TextIOWrapper.__init__
encoding: str(accept={str, NoneType}) = None encoding: str(accept={str, NoneType}) = None
errors: object = None errors: object = None
newline: str(accept={str, NoneType}) = None newline: str(accept={str, NoneType}) = None
line_buffering: bool(accept={int}) = False line_buffering: bool = False
write_through: bool(accept={int}) = False write_through: bool = False
Character and line based layer over a BufferedIOBase object, buffer. Character and line based layer over a BufferedIOBase object, buffer.
@ -1061,7 +1061,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
const char *encoding, PyObject *errors, const char *encoding, PyObject *errors,
const char *newline, int line_buffering, const char *newline, int line_buffering,
int write_through) int write_through)
/*[clinic end generated code: output=72267c0c01032ed2 input=72590963698f289b]*/ /*[clinic end generated code: output=72267c0c01032ed2 input=e6cfaaaf6059d4f5]*/
{ {
PyObject *raw, *codec_info = NULL; PyObject *raw, *codec_info = NULL;
PyObject *res; PyObject *res;

View File

@ -235,7 +235,7 @@ winconsoleio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
_io._WindowsConsoleIO.__init__ _io._WindowsConsoleIO.__init__
file as nameobj: object file as nameobj: object
mode: str = "r" mode: str = "r"
closefd: bool(accept={int}) = True closefd: bool = True
opener: object = None opener: object = None
Open a console buffer by file descriptor. Open a console buffer by file descriptor.
@ -249,7 +249,7 @@ static int
_io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj, _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
const char *mode, int closefd, const char *mode, int closefd,
PyObject *opener) PyObject *opener)
/*[clinic end generated code: output=3fd9cbcdd8d95429 input=06ae4b863c63244b]*/ /*[clinic end generated code: output=3fd9cbcdd8d95429 input=7a3eed6bbe998fd9]*/
{ {
const char *s; const char *s;
wchar_t *name = NULL; wchar_t *name = NULL;

View File

@ -556,7 +556,7 @@ py_scanstring(PyObject* Py_UNUSED(self), PyObject *args)
Py_ssize_t end; Py_ssize_t end;
Py_ssize_t next_end = -1; Py_ssize_t next_end = -1;
int strict = 1; int strict = 1;
if (!PyArg_ParseTuple(args, "On|i:scanstring", &pystr, &end, &strict)) { if (!PyArg_ParseTuple(args, "On|p:scanstring", &pystr, &end, &strict)) {
return NULL; return NULL;
} }
if (PyUnicode_Check(pystr)) { if (PyUnicode_Check(pystr)) {

View File

@ -667,7 +667,7 @@ profiler_enable(ProfilerObject *self, PyObject *args, PyObject *kwds)
int subcalls = -1; int subcalls = -1;
int builtins = -1; int builtins = -1;
static char *kwlist[] = {"subcalls", "builtins", 0}; static char *kwlist[] = {"subcalls", "builtins", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ii:enable", if (!PyArg_ParseTupleAndKeywords(args, kwds, "|pp:enable",
kwlist, &subcalls, &builtins)) kwlist, &subcalls, &builtins))
return NULL; return NULL;
if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtins) < 0) { 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", static char *kwlist[] = {"timer", "timeunit",
"subcalls", "builtins", 0}; "subcalls", "builtins", 0};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odii:Profiler", kwlist, if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odpp:Profiler", kwlist,
&timer, &timeunit, &timer, &timeunit,
&subcalls, &builtins)) &subcalls, &builtins))
return -1; return -1;

View File

@ -65,8 +65,8 @@ _multiprocessing_SemLock_acquire(SemLockObject *self, PyObject *const *args, Py_
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[0]) { if (args[0]) {
blocking = _PyLong_AsInt(args[0]); blocking = PyObject_IsTrue(args[0]);
if (blocking == -1 && PyErr_Occurred()) { if (blocking < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -162,8 +162,8 @@ _multiprocessing_SemLock_acquire(SemLockObject *self, PyObject *const *args, Py_
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[0]) { if (args[0]) {
blocking = _PyLong_AsInt(args[0]); blocking = PyObject_IsTrue(args[0]);
if (blocking == -1 && PyErr_Occurred()) { if (blocking < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -275,8 +275,8 @@ _multiprocessing_SemLock(PyTypeObject *type, PyObject *args, PyObject *kwargs)
PyErr_SetString(PyExc_ValueError, "embedded null character"); PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit; goto exit;
} }
unlink = _PyLong_AsInt(fastargs[4]); unlink = PyObject_IsTrue(fastargs[4]);
if (unlink == -1 && PyErr_Occurred()) { if (unlink < 0) {
goto exit; goto exit;
} }
return_value = _multiprocessing_SemLock_impl(type, kind, value, maxvalue, name, unlink); return_value = _multiprocessing_SemLock_impl(type, kind, value, maxvalue, name, unlink);
@ -542,4 +542,4 @@ exit:
#ifndef _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF #ifndef _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
#define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF #define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
#endif /* !defined(_MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF) */ #endif /* !defined(_MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF) */
/*[clinic end generated code: output=720d7d0066dc0954 input=a9049054013a1b77]*/ /*[clinic end generated code: output=dae57a702cc01512 input=a9049054013a1b77]*/

View File

@ -79,7 +79,7 @@ _GetSemaphoreValue(HANDLE handle, long *value)
/*[clinic input] /*[clinic input]
_multiprocessing.SemLock.acquire _multiprocessing.SemLock.acquire
block as blocking: bool(accept={int}) = True block as blocking: bool = True
timeout as timeout_obj: object = None timeout as timeout_obj: object = None
Acquire the semaphore/lock. Acquire the semaphore/lock.
@ -88,7 +88,7 @@ Acquire the semaphore/lock.
static PyObject * static PyObject *
_multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking, _multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking,
PyObject *timeout_obj) PyObject *timeout_obj)
/*[clinic end generated code: output=f9998f0b6b0b0872 input=86f05662cf753eb4]*/ /*[clinic end generated code: output=f9998f0b6b0b0872 input=e5b45f5cbb775166]*/
{ {
double timeout; double timeout;
DWORD res, full_msecs, nhandles; DWORD res, full_msecs, nhandles;
@ -295,7 +295,7 @@ sem_timedwait_save(sem_t *sem, struct timespec *deadline, PyThreadState *_save)
/*[clinic input] /*[clinic input]
_multiprocessing.SemLock.acquire _multiprocessing.SemLock.acquire
block as blocking: bool(accept={int}) = True block as blocking: bool = True
timeout as timeout_obj: object = None timeout as timeout_obj: object = None
Acquire the semaphore/lock. Acquire the semaphore/lock.
@ -304,7 +304,7 @@ Acquire the semaphore/lock.
static PyObject * static PyObject *
_multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking, _multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking,
PyObject *timeout_obj) PyObject *timeout_obj)
/*[clinic end generated code: output=f9998f0b6b0b0872 input=86f05662cf753eb4]*/ /*[clinic end generated code: output=f9998f0b6b0b0872 input=e5b45f5cbb775166]*/
{ {
int res, err = 0; int res, err = 0;
struct timespec deadline = {0}; struct timespec deadline = {0};
@ -474,14 +474,14 @@ _multiprocessing.SemLock.__new__
value: int value: int
maxvalue: int maxvalue: int
name: str name: str
unlink: bool(accept={int}) unlink: bool
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_multiprocessing_SemLock_impl(PyTypeObject *type, int kind, int value, _multiprocessing_SemLock_impl(PyTypeObject *type, int kind, int value,
int maxvalue, const char *name, int unlink) int maxvalue, const char *name, int unlink)
/*[clinic end generated code: output=30727e38f5f7577a input=b378c3ee27d3a0fa]*/ /*[clinic end generated code: output=30727e38f5f7577a input=fdaeb69814471c5b]*/
{ {
SEM_HANDLE handle = SEM_FAILED; SEM_HANDLE handle = SEM_FAILED;
PyObject *result; PyObject *result;

View File

@ -814,7 +814,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
int allow_vfork; int allow_vfork;
if (!PyArg_ParseTuple( if (!PyArg_ParseTuple(
args, "OOpO!OOiiiiiiiiii" _Py_PARSE_PID "OOOiOp:fork_exec", args, "OOpO!OOiiiiiiiipp" _Py_PARSE_PID "OOOiOp:fork_exec",
&process_args, &executable_list, &process_args, &executable_list,
&close_fds, &PyTuple_Type, &py_fds_to_keep, &close_fds, &PyTuple_Type, &py_fds_to_keep,
&cwd_obj, &env_list, &cwd_obj, &env_list,

View File

@ -100,8 +100,8 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[4]) { if (fastargs[4]) {
check_same_thread = _PyLong_AsInt(fastargs[4]); check_same_thread = PyObject_IsTrue(fastargs[4]);
if (check_same_thread == -1 && PyErr_Occurred()) { if (check_same_thread < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -305,8 +305,8 @@ blobopen(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyO
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (args[3]) { if (args[3]) {
readonly = _PyLong_AsInt(args[3]); readonly = PyObject_IsTrue(args[3]);
if (readonly == -1 && PyErr_Occurred()) { if (readonly < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -831,8 +831,8 @@ pysqlite_connection_enable_load_extension(pysqlite_Connection *self, PyObject *a
PyObject *return_value = NULL; PyObject *return_value = NULL;
int onoff; int onoff;
onoff = _PyLong_AsInt(arg); onoff = PyObject_IsTrue(arg);
if (onoff == -1 && PyErr_Occurred()) { if (onoff < 0) {
goto exit; goto exit;
} }
return_value = pysqlite_connection_enable_load_extension_impl(self, onoff); return_value = pysqlite_connection_enable_load_extension_impl(self, onoff);
@ -1532,4 +1532,4 @@ exit:
#ifndef DESERIALIZE_METHODDEF #ifndef DESERIALIZE_METHODDEF
#define DESERIALIZE_METHODDEF #define DESERIALIZE_METHODDEF
#endif /* !defined(DESERIALIZE_METHODDEF) */ #endif /* !defined(DESERIALIZE_METHODDEF) */
/*[clinic end generated code: output=20e929a7a7d62a01 input=a9049054013a1b77]*/ /*[clinic end generated code: output=f10306e10427488b input=a9049054013a1b77]*/

View File

@ -197,7 +197,7 @@ _sqlite3.Connection.__init__ as pysqlite_connection_init
timeout: double = 5.0 timeout: double = 5.0
detect_types: int = 0 detect_types: int = 0
isolation_level: IsolationLevel = "" isolation_level: IsolationLevel = ""
check_same_thread: bool(accept={int}) = True check_same_thread: bool = True
factory: object(c_default='(PyObject*)clinic_state()->ConnectionType') = ConnectionType factory: object(c_default='(PyObject*)clinic_state()->ConnectionType') = ConnectionType
cached_statements as cache_size: int = 128 cached_statements as cache_size: int = 128
uri: bool = False uri: bool = False
@ -212,7 +212,7 @@ pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database,
int check_same_thread, PyObject *factory, int check_same_thread, PyObject *factory,
int cache_size, int uri, int cache_size, int uri,
enum autocommit_mode autocommit) enum autocommit_mode autocommit)
/*[clinic end generated code: output=cba057313ea7712f input=b21abce28ebcd304]*/ /*[clinic end generated code: output=cba057313ea7712f input=9b0ab6c12f674fa3]*/
{ {
if (PySys_Audit("sqlite3.connect", "O", database) < 0) { if (PySys_Audit("sqlite3.connect", "O", database) < 0) {
return -1; return -1;
@ -485,7 +485,7 @@ _sqlite3.Connection.blobopen as blobopen
Row index. Row index.
/ /
* *
readonly: bool(accept={int}) = False readonly: bool = False
Open the BLOB without write permissions. Open the BLOB without write permissions.
name: str = "main" name: str = "main"
Database name. Database name.
@ -496,7 +496,7 @@ Open and return a BLOB object.
static PyObject * static PyObject *
blobopen_impl(pysqlite_Connection *self, const char *table, const char *col, blobopen_impl(pysqlite_Connection *self, const char *table, const char *col,
int row, int readonly, const char *name) int row, int readonly, const char *name)
/*[clinic end generated code: output=0c8e2e58516d0b5c input=1e7052516acfc94d]*/ /*[clinic end generated code: output=0c8e2e58516d0b5c input=fa73c83aa7a7ddee]*/
{ {
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL; return NULL;
@ -1564,7 +1564,7 @@ pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
/*[clinic input] /*[clinic input]
_sqlite3.Connection.enable_load_extension as pysqlite_connection_enable_load_extension _sqlite3.Connection.enable_load_extension as pysqlite_connection_enable_load_extension
enable as onoff: bool(accept={int}) enable as onoff: bool
/ /
Enable dynamic loading of SQLite extension modules. Enable dynamic loading of SQLite extension modules.
@ -1573,7 +1573,7 @@ Enable dynamic loading of SQLite extension modules.
static PyObject * static PyObject *
pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self, pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
int onoff) int onoff)
/*[clinic end generated code: output=9cac37190d388baf input=5f00e93f7a9d3540]*/ /*[clinic end generated code: output=9cac37190d388baf input=2a1e87931486380f]*/
{ {
int rc; int rc;

View File

@ -4168,7 +4168,7 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath)
/*[clinic input] /*[clinic input]
_ssl._SSLContext._wrap_socket _ssl._SSLContext._wrap_socket
sock: object(subclass_of="get_state_ctx(self)->Sock_Type") sock: object(subclass_of="get_state_ctx(self)->Sock_Type")
server_side: int server_side: bool
server_hostname as hostname_obj: object = None server_hostname as hostname_obj: object = None
* *
owner: object = None owner: object = None
@ -4180,7 +4180,7 @@ static PyObject *
_ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock, _ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock,
int server_side, PyObject *hostname_obj, int server_side, PyObject *hostname_obj,
PyObject *owner, PyObject *session) PyObject *owner, PyObject *session)
/*[clinic end generated code: output=f103f238633940b4 input=f5916eadbc6eae81]*/ /*[clinic end generated code: output=f103f238633940b4 input=700ca8fedff53994]*/
{ {
char *hostname = NULL; char *hostname = NULL;
PyObject *res; PyObject *res;
@ -4205,7 +4205,7 @@ _ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock,
_ssl._SSLContext._wrap_bio _ssl._SSLContext._wrap_bio
incoming: object(subclass_of="get_state_ctx(self)->PySSLMemoryBIO_Type", type="PySSLMemoryBIO *") incoming: object(subclass_of="get_state_ctx(self)->PySSLMemoryBIO_Type", type="PySSLMemoryBIO *")
outgoing: object(subclass_of="get_state_ctx(self)->PySSLMemoryBIO_Type", type="PySSLMemoryBIO *") outgoing: object(subclass_of="get_state_ctx(self)->PySSLMemoryBIO_Type", type="PySSLMemoryBIO *")
server_side: int server_side: bool
server_hostname as hostname_obj: object = None server_hostname as hostname_obj: object = None
* *
owner: object = None owner: object = None
@ -4218,7 +4218,7 @@ _ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming,
PySSLMemoryBIO *outgoing, int server_side, PySSLMemoryBIO *outgoing, int server_side,
PyObject *hostname_obj, PyObject *owner, PyObject *hostname_obj, PyObject *owner,
PyObject *session) PyObject *session)
/*[clinic end generated code: output=5c5d6d9b41f99332 input=331edeec9c738382]*/ /*[clinic end generated code: output=5c5d6d9b41f99332 input=a9205d097fd45a82]*/
{ {
char *hostname = NULL; char *hostname = NULL;
PyObject *res; PyObject *res;

View File

@ -135,7 +135,7 @@ lock_acquire_parse_args(PyObject *args, PyObject *kwds,
*timeout = unset_timeout ; *timeout = unset_timeout ;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO:acquire", kwlist, if (!PyArg_ParseTupleAndKeywords(args, kwds, "|pO:acquire", kwlist,
&blocking, &timeout_obj)) &blocking, &timeout_obj))
return -1; return -1;

View File

@ -2832,7 +2832,7 @@ Tkapp_WantObjects(PyObject *self, PyObject *args)
{ {
int wantobjects = -1; int wantobjects = -1;
if (!PyArg_ParseTuple(args, "|i:wantobjects", &wantobjects)) if (!PyArg_ParseTuple(args, "|p:wantobjects", &wantobjects))
return NULL; return NULL;
if (wantobjects == -1) if (wantobjects == -1)
return PyBool_FromLong(((TkappObject*)self)->wantobjects); return PyBool_FromLong(((TkappObject*)self)->wantobjects);
@ -2978,11 +2978,11 @@ _tkinter.create
screenName: str(accept={str, NoneType}) = None screenName: str(accept={str, NoneType}) = None
baseName: str = "" baseName: str = ""
className: str = "Tk" className: str = "Tk"
interactive: bool(accept={int}) = False interactive: bool = False
wantobjects: bool(accept={int}) = False wantobjects: bool = False
wantTk: bool(accept={int}) = True wantTk: bool = True
if false, then Tk_Init() doesn't get called if false, then Tk_Init() doesn't get called
sync: bool(accept={int}) = False sync: bool = False
if true, then pass -sync to wish if true, then pass -sync to wish
use: str(accept={str, NoneType}) = None use: str(accept={str, NoneType}) = None
if not None, then pass -use to wish if not None, then pass -use to wish
@ -2995,7 +2995,7 @@ _tkinter_create_impl(PyObject *module, const char *screenName,
const char *baseName, const char *className, const char *baseName, const char *className,
int interactive, int wantobjects, int wantTk, int sync, int interactive, int wantobjects, int wantTk, int sync,
const char *use) const char *use)
/*[clinic end generated code: output=e3315607648e6bb4 input=da9b17ee7358d862]*/ /*[clinic end generated code: output=e3315607648e6bb4 input=09afef9adea70a19]*/
{ {
/* XXX baseName is not used anymore; /* XXX baseName is not used anymore;
* try getting rid of it. */ * try getting rid of it. */

View File

@ -404,13 +404,13 @@ _winapi_CloseHandle_impl(PyObject *module, HANDLE handle)
_winapi.ConnectNamedPipe _winapi.ConnectNamedPipe
handle: HANDLE handle: HANDLE
overlapped as use_overlapped: bool(accept={int}) = False overlapped as use_overlapped: bool = False
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle, _winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle,
int use_overlapped) int use_overlapped)
/*[clinic end generated code: output=335a0e7086800671 input=34f937c1c86e5e68]*/ /*[clinic end generated code: output=335a0e7086800671 input=a80e56e8bd370e31]*/
{ {
BOOL success; BOOL success;
OverlappedObject *overlapped = NULL; OverlappedObject *overlapped = NULL;
@ -1576,13 +1576,13 @@ _winapi.ReadFile
handle: HANDLE handle: HANDLE
size: DWORD size: DWORD
overlapped as use_overlapped: bool(accept={int}) = False overlapped as use_overlapped: bool = False
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, DWORD size, _winapi_ReadFile_impl(PyObject *module, HANDLE handle, DWORD size,
int use_overlapped) int use_overlapped)
/*[clinic end generated code: output=d3d5b44a8201b944 input=08c439d03a11aac5]*/ /*[clinic end generated code: output=d3d5b44a8201b944 input=4f82f8e909ad91ad]*/
{ {
DWORD nread; DWORD nread;
PyObject *buf; PyObject *buf;
@ -1862,13 +1862,13 @@ _winapi.WriteFile
handle: HANDLE handle: HANDLE
buffer: object buffer: object
overlapped as use_overlapped: bool(accept={int}) = False overlapped as use_overlapped: bool = False
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_winapi_WriteFile_impl(PyObject *module, HANDLE handle, PyObject *buffer, _winapi_WriteFile_impl(PyObject *module, HANDLE handle, PyObject *buffer,
int use_overlapped) int use_overlapped)
/*[clinic end generated code: output=2ca80f6bf3fa92e3 input=11eae2a03aa32731]*/ /*[clinic end generated code: output=2ca80f6bf3fa92e3 input=2badb008c8a2e2a0]*/
{ {
Py_buffer _buf, *buf; Py_buffer _buf, *buf;
DWORD len, written; DWORD len, written;

View File

@ -303,14 +303,14 @@ binascii.b2a_uu
data: Py_buffer data: Py_buffer
/ /
* *
backtick: bool(accept={int}) = False backtick: bool = False
Uuencode line of data. Uuencode line of data.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
binascii_b2a_uu_impl(PyObject *module, Py_buffer *data, int backtick) binascii_b2a_uu_impl(PyObject *module, Py_buffer *data, int backtick)
/*[clinic end generated code: output=b1b99de62d9bbeb8 input=b26bc8d32b6ed2f6]*/ /*[clinic end generated code: output=b1b99de62d9bbeb8 input=beb27822241095cd]*/
{ {
unsigned char *ascii_data; unsigned char *ascii_data;
const unsigned char *bin_data; const unsigned char *bin_data;
@ -375,7 +375,7 @@ binascii.a2b_base64
data: ascii_buffer data: ascii_buffer
/ /
* *
strict_mode: bool(accept={int}) = False strict_mode: bool = False
Decode a line of base64 data. Decode a line of base64 data.
@ -386,7 +386,7 @@ Decode a line of base64 data.
static PyObject * static PyObject *
binascii_a2b_base64_impl(PyObject *module, Py_buffer *data, int strict_mode) binascii_a2b_base64_impl(PyObject *module, Py_buffer *data, int strict_mode)
/*[clinic end generated code: output=5409557788d4f975 input=3a30c4e3528317c6]*/ /*[clinic end generated code: output=5409557788d4f975 input=c0c15fd0f8f9a62d]*/
{ {
assert(data->len >= 0); assert(data->len >= 0);
@ -521,14 +521,14 @@ binascii.b2a_base64
data: Py_buffer data: Py_buffer
/ /
* *
newline: bool(accept={int}) = True newline: bool = True
Base64-code line of data. Base64-code line of data.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline) binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline)
/*[clinic end generated code: output=4ad62c8e8485d3b3 input=6083dac5777fa45d]*/ /*[clinic end generated code: output=4ad62c8e8485d3b3 input=0e20ff59c5f2e3e1]*/
{ {
unsigned char *ascii_data; unsigned char *ascii_data;
const unsigned char *bin_data; const unsigned char *bin_data;
@ -952,14 +952,14 @@ binascii_unhexlify_impl(PyObject *module, Py_buffer *hexstr)
binascii.a2b_qp binascii.a2b_qp
data: ascii_buffer data: ascii_buffer
header: bool(accept={int}) = False header: bool = False
Decode a string of qp-encoded data. Decode a string of qp-encoded data.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header) binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header)
/*[clinic end generated code: output=e99f7846cfb9bc53 input=bf6766fea76cce8f]*/ /*[clinic end generated code: output=e99f7846cfb9bc53 input=bdfb31598d4e47b9]*/
{ {
Py_ssize_t in, out; Py_ssize_t in, out;
char ch; char ch;
@ -1048,9 +1048,9 @@ to_hex (unsigned char ch, unsigned char *s)
binascii.b2a_qp binascii.b2a_qp
data: Py_buffer data: Py_buffer
quotetabs: bool(accept={int}) = False quotetabs: bool = False
istext: bool(accept={int}) = True istext: bool = True
header: bool(accept={int}) = False header: bool = False
Encode a string using quoted-printable encoding. Encode a string using quoted-printable encoding.
@ -1062,7 +1062,7 @@ are both encoded. When quotetabs is set, space and tabs are encoded.
static PyObject * static PyObject *
binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs, binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
int istext, int header) int istext, int header)
/*[clinic end generated code: output=e9884472ebb1a94c input=21fb7eea4a184ba6]*/ /*[clinic end generated code: output=e9884472ebb1a94c input=e9102879afb0defd]*/
{ {
Py_ssize_t in, out; Py_ssize_t in, out;
const unsigned char *databuf; const unsigned char *databuf;

View File

@ -246,8 +246,8 @@ _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
final = _PyLong_AsInt(args[1]); final = PyObject_IsTrue(args[1]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -381,8 +381,8 @@ _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
final = _PyLong_AsInt(args[1]); final = PyObject_IsTrue(args[1]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -690,4 +690,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
/*[clinic end generated code: output=b034ec7126c11bde input=a9049054013a1b77]*/ /*[clinic end generated code: output=5f0e8dacddb0ac76 input=a9049054013a1b77]*/

View File

@ -893,14 +893,14 @@ decoder_feed_buffer(MultibyteStatefulDecoderContext *ctx,
_multibytecodec.MultibyteIncrementalEncoder.encode _multibytecodec.MultibyteIncrementalEncoder.encode
input: object input: object
final: bool(accept={int}) = False final: bool = False
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self, _multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self,
PyObject *input, PyObject *input,
int final) int final)
/*[clinic end generated code: output=123361b6c505e2c1 input=093a1ddbb2fc6721]*/ /*[clinic end generated code: output=123361b6c505e2c1 input=bd5f7d40d43e99b0]*/
{ {
return encoder_encode_stateful(STATEFUL_ECTX(self), input, final); return encoder_encode_stateful(STATEFUL_ECTX(self), input, final);
} }
@ -1114,14 +1114,14 @@ static PyType_Spec encoder_spec = {
_multibytecodec.MultibyteIncrementalDecoder.decode _multibytecodec.MultibyteIncrementalDecoder.decode
input: Py_buffer input: Py_buffer
final: bool(accept={int}) = False final: bool = False
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self, _multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self,
Py_buffer *input, Py_buffer *input,
int final) int final)
/*[clinic end generated code: output=b9b9090e8a9ce2ba input=c9132b24d503eb1d]*/ /*[clinic end generated code: output=b9b9090e8a9ce2ba input=8795fbb20860027a]*/
{ {
MultibyteDecodeBuffer buf; MultibyteDecodeBuffer buf;
char *data, *wdata = NULL; char *data, *wdata = NULL;

View File

@ -450,8 +450,8 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -520,8 +520,8 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -590,8 +590,8 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -660,8 +660,8 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -730,8 +730,8 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -809,8 +809,8 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[3]); final = PyObject_IsTrue(args[3]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -879,8 +879,8 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -949,8 +949,8 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1019,8 +1019,8 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1098,8 +1098,8 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[3]); final = PyObject_IsTrue(args[3]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1178,8 +1178,8 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1258,8 +1258,8 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ss
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1521,8 +1521,8 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1595,8 +1595,8 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[2]); final = PyObject_IsTrue(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -1674,8 +1674,8 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
final = _PyLong_AsInt(args[3]); final = PyObject_IsTrue(args[3]);
if (final == -1 && PyErr_Occurred()) { if (final < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -2869,4 +2869,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
/*[clinic end generated code: output=e885abad241bc54d input=a9049054013a1b77]*/ /*[clinic end generated code: output=603da07cf8dfeb4b input=a9049054013a1b77]*/

View File

@ -1748,7 +1748,7 @@ _curses_window_touchline(PyCursesWindowObject *self, PyObject *args)
} }
break; break;
case 3: case 3:
if (!PyArg_ParseTuple(args, "iii:touchline", &start, &count, &changed)) { if (!PyArg_ParseTuple(args, "iip:touchline", &start, &count, &changed)) {
goto exit; goto exit;
} }
group_right_1 = 1; group_right_1 = 1;
@ -1941,8 +1941,8 @@ _curses_cbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
flag = _PyLong_AsInt(args[0]); flag = PyObject_IsTrue(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -2177,8 +2177,8 @@ _curses_echo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
flag = _PyLong_AsInt(args[0]); flag = PyObject_IsTrue(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -2900,8 +2900,8 @@ _curses_intrflush(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flag; int flag;
flag = _PyLong_AsInt(arg); flag = PyObject_IsTrue(arg);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
return_value = _curses_intrflush_impl(module, flag); return_value = _curses_intrflush_impl(module, flag);
@ -3064,8 +3064,8 @@ _curses_meta(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int yes; int yes;
yes = _PyLong_AsInt(arg); yes = PyObject_IsTrue(arg);
if (yes == -1 && PyErr_Occurred()) { if (yes < 0) {
goto exit; goto exit;
} }
return_value = _curses_meta_impl(module, yes); return_value = _curses_meta_impl(module, yes);
@ -3308,8 +3308,8 @@ _curses_nl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
flag = _PyLong_AsInt(args[0]); flag = PyObject_IsTrue(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -3540,8 +3540,8 @@ _curses_qiflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
flag = _PyLong_AsInt(args[0]); flag = PyObject_IsTrue(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -3603,8 +3603,8 @@ _curses_raw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
flag = _PyLong_AsInt(args[0]); flag = PyObject_IsTrue(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
skip_optional: skip_optional:
@ -4164,8 +4164,8 @@ _curses_use_env(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flag; int flag;
flag = _PyLong_AsInt(arg); flag = PyObject_IsTrue(arg);
if (flag == -1 && PyErr_Occurred()) { if (flag < 0) {
goto exit; goto exit;
} }
return_value = _curses_use_env_impl(module, flag); return_value = _curses_use_env_impl(module, flag);
@ -4313,4 +4313,4 @@ _curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF #ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */ #endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
/*[clinic end generated code: output=b2e71e2012f16197 input=a9049054013a1b77]*/ /*[clinic end generated code: output=27a2364193b503c1 input=a9049054013a1b77]*/

View File

@ -757,8 +757,8 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
goto exit; goto exit;
} }
sock = args[0]; sock = args[0];
server_side = _PyLong_AsInt(args[1]); server_side = PyObject_IsTrue(args[1]);
if (server_side == -1 && PyErr_Occurred()) { if (server_side < 0) {
goto exit; goto exit;
} }
if (!noptargs) { if (!noptargs) {
@ -855,8 +855,8 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
goto exit; goto exit;
} }
outgoing = (PySSLMemoryBIO *)args[1]; outgoing = (PySSLMemoryBIO *)args[1];
server_side = _PyLong_AsInt(args[2]); server_side = PyObject_IsTrue(args[2]);
if (server_side == -1 && PyErr_Occurred()) { if (server_side < 0) {
goto exit; goto exit;
} }
if (!noptargs) { if (!noptargs) {
@ -1543,4 +1543,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF #ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
/*[clinic end generated code: output=9f477b0c709acb28 input=a9049054013a1b77]*/ /*[clinic end generated code: output=a3d97a19163bb044 input=a9049054013a1b77]*/

View File

@ -747,29 +747,29 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
interactive = _PyLong_AsInt(args[3]); interactive = PyObject_IsTrue(args[3]);
if (interactive == -1 && PyErr_Occurred()) { if (interactive < 0) {
goto exit; goto exit;
} }
if (nargs < 5) { if (nargs < 5) {
goto skip_optional; goto skip_optional;
} }
wantobjects = _PyLong_AsInt(args[4]); wantobjects = PyObject_IsTrue(args[4]);
if (wantobjects == -1 && PyErr_Occurred()) { if (wantobjects < 0) {
goto exit; goto exit;
} }
if (nargs < 6) { if (nargs < 6) {
goto skip_optional; goto skip_optional;
} }
wantTk = _PyLong_AsInt(args[5]); wantTk = PyObject_IsTrue(args[5]);
if (wantTk == -1 && PyErr_Occurred()) { if (wantTk < 0) {
goto exit; goto exit;
} }
if (nargs < 7) { if (nargs < 7) {
goto skip_optional; goto skip_optional;
} }
sync = _PyLong_AsInt(args[6]); sync = PyObject_IsTrue(args[6]);
if (sync == -1 && PyErr_Occurred()) { if (sync < 0) {
goto exit; goto exit;
} }
if (nargs < 8) { if (nargs < 8) {
@ -865,4 +865,4 @@ exit:
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
/*[clinic end generated code: output=d022835d05fc8608 input=a9049054013a1b77]*/ /*[clinic end generated code: output=2a4e3bf8448604b5 input=a9049054013a1b77]*/

View File

@ -133,7 +133,7 @@ _winapi_ConnectNamedPipe(PyObject *module, PyObject *const *args, Py_ssize_t nar
static const char * const _keywords[] = {"handle", "overlapped", NULL}; static const char * const _keywords[] = {"handle", "overlapped", NULL};
static _PyArg_Parser _parser = { static _PyArg_Parser _parser = {
.keywords = _keywords, .keywords = _keywords,
.format = "" F_HANDLE "|i:ConnectNamedPipe", .format = "" F_HANDLE "|p:ConnectNamedPipe",
.kwtuple = KWTUPLE, .kwtuple = KWTUPLE,
}; };
#undef KWTUPLE #undef KWTUPLE
@ -972,7 +972,7 @@ _winapi_ReadFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
static const char * const _keywords[] = {"handle", "size", "overlapped", NULL}; static const char * const _keywords[] = {"handle", "size", "overlapped", NULL};
static _PyArg_Parser _parser = { static _PyArg_Parser _parser = {
.keywords = _keywords, .keywords = _keywords,
.format = "" F_HANDLE "k|i:ReadFile", .format = "" F_HANDLE "k|p:ReadFile",
.kwtuple = KWTUPLE, .kwtuple = KWTUPLE,
}; };
#undef KWTUPLE #undef KWTUPLE
@ -1220,7 +1220,7 @@ _winapi_WriteFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
static const char * const _keywords[] = {"handle", "buffer", "overlapped", NULL}; static const char * const _keywords[] = {"handle", "buffer", "overlapped", NULL};
static _PyArg_Parser _parser = { static _PyArg_Parser _parser = {
.keywords = _keywords, .keywords = _keywords,
.format = "" F_HANDLE "O|i:WriteFile", .format = "" F_HANDLE "O|p:WriteFile",
.kwtuple = KWTUPLE, .kwtuple = KWTUPLE,
}; };
#undef KWTUPLE #undef KWTUPLE
@ -1371,4 +1371,4 @@ _winapi__mimetypes_read_windows_registry(PyObject *module, PyObject *const *args
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=23ea9e176d86e026 input=a9049054013a1b77]*/ /*[clinic end generated code: output=edb1a9d1bbfd6394 input=a9049054013a1b77]*/

View File

@ -99,8 +99,8 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
backtick = _PyLong_AsInt(args[1]); backtick = PyObject_IsTrue(args[1]);
if (backtick == -1 && PyErr_Occurred()) { if (backtick < 0) {
goto exit; goto exit;
} }
skip_optional_kwonly: skip_optional_kwonly:
@ -175,8 +175,8 @@ binascii_a2b_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
strict_mode = _PyLong_AsInt(args[1]); strict_mode = PyObject_IsTrue(args[1]);
if (strict_mode == -1 && PyErr_Occurred()) { if (strict_mode < 0) {
goto exit; goto exit;
} }
skip_optional_kwonly: skip_optional_kwonly:
@ -250,8 +250,8 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
newline = _PyLong_AsInt(args[1]); newline = PyObject_IsTrue(args[1]);
if (newline == -1 && PyErr_Occurred()) { if (newline < 0) {
goto exit; goto exit;
} }
skip_optional_kwonly: skip_optional_kwonly:
@ -680,8 +680,8 @@ binascii_a2b_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
header = _PyLong_AsInt(args[1]); header = PyObject_IsTrue(args[1]);
if (header == -1 && PyErr_Occurred()) { if (header < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -763,8 +763,8 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
quotetabs = _PyLong_AsInt(args[1]); quotetabs = PyObject_IsTrue(args[1]);
if (quotetabs == -1 && PyErr_Occurred()) { if (quotetabs < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -772,16 +772,16 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[2]) { if (args[2]) {
istext = _PyLong_AsInt(args[2]); istext = PyObject_IsTrue(args[2]);
if (istext == -1 && PyErr_Occurred()) { if (istext < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
header = _PyLong_AsInt(args[3]); header = PyObject_IsTrue(args[3]);
if (header == -1 && PyErr_Occurred()) { if (header < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -795,4 +795,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=a266ba13c374aefa input=a9049054013a1b77]*/ /*[clinic end generated code: output=ab156917c9db79d2 input=a9049054013a1b77]*/

View File

@ -3110,8 +3110,8 @@ os_posix_spawn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[5]) { if (args[5]) {
resetids = _PyLong_AsInt(args[5]); resetids = PyObject_IsTrue(args[5]);
if (resetids == -1 && PyErr_Occurred()) { if (resetids < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -3119,8 +3119,8 @@ os_posix_spawn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[6]) { if (args[6]) {
setsid = _PyLong_AsInt(args[6]); setsid = PyObject_IsTrue(args[6]);
if (setsid == -1 && PyErr_Occurred()) { if (setsid < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -3260,8 +3260,8 @@ os_posix_spawnp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[5]) { if (args[5]) {
resetids = _PyLong_AsInt(args[5]); resetids = PyObject_IsTrue(args[5]);
if (resetids == -1 && PyErr_Occurred()) { if (resetids < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -3269,8 +3269,8 @@ os_posix_spawnp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[6]) { if (args[6]) {
setsid = _PyLong_AsInt(args[6]); setsid = PyObject_IsTrue(args[6]);
if (setsid == -1 && PyErr_Occurred()) { if (setsid < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -10225,8 +10225,8 @@ os_set_blocking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
blocking = _PyLong_AsInt(args[1]); blocking = PyObject_IsTrue(args[1]);
if (blocking == -1 && PyErr_Occurred()) { if (blocking < 0) {
goto exit; goto exit;
} }
return_value = os_set_blocking_impl(module, fd, blocking); return_value = os_set_blocking_impl(module, fd, blocking);
@ -11549,4 +11549,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
/*[clinic end generated code: output=4192d8e09e216300 input=a9049054013a1b77]*/ /*[clinic end generated code: output=04fd23c89ab41f75 input=a9049054013a1b77]*/

View File

@ -52,8 +52,8 @@ pyexpat_xmlparser_Parse(xmlparseobject *self, PyTypeObject *cls, PyObject *const
if (nargs < 2) { if (nargs < 2) {
goto skip_optional_posonly; goto skip_optional_posonly;
} }
isfinal = _PyLong_AsInt(args[1]); isfinal = PyObject_IsTrue(args[1]);
if (isfinal == -1 && PyErr_Occurred()) { if (isfinal < 0) {
goto exit; goto exit;
} }
skip_optional_posonly: skip_optional_posonly:
@ -498,4 +498,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=de5f664ef05ef34a input=a9049054013a1b77]*/ /*[clinic end generated code: output=63efc62e24a7b5a7 input=a9049054013a1b77]*/

View File

@ -270,7 +270,7 @@ faulthandler_dump_traceback_py(PyObject *self,
int fd; int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|Oi:dump_traceback", kwlist, "|Op:dump_traceback", kwlist,
&file, &all_threads)) &file, &all_threads))
return NULL; return NULL;
@ -546,7 +546,7 @@ faulthandler_py_enable(PyObject *self, PyObject *args, PyObject *kwargs)
PyThreadState *tstate; PyThreadState *tstate;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|Oi:enable", kwlist, &file, &all_threads)) "|Op:enable", kwlist, &file, &all_threads))
return NULL; return NULL;
fd = faulthandler_get_fileno(&file); fd = faulthandler_get_fileno(&file);
@ -916,7 +916,7 @@ faulthandler_register_py(PyObject *self,
int err; int err;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"i|Oii:register", kwlist, "i|Opp:register", kwlist,
&signum, &file, &all_threads, &chain)) &signum, &file, &all_threads, &chain))
return NULL; return NULL;

View File

@ -1368,12 +1368,12 @@ cycle_setstate(cycleobject *lz, PyObject *state)
PyErr_SetString(PyExc_TypeError, "state is not a tuple"); PyErr_SetString(PyExc_TypeError, "state is not a tuple");
return NULL; return NULL;
} }
if (!PyArg_ParseTuple(state, "O!i", &PyList_Type, &saved, &firstpass)) { if (!PyArg_ParseTuple(state, "O!p", &PyList_Type, &saved, &firstpass)) {
return NULL; return NULL;
} }
Py_INCREF(saved); Py_INCREF(saved);
Py_XSETREF(lz->saved, saved); Py_XSETREF(lz->saved, saved);
lz->firstpass = firstpass != 0; lz->firstpass = firstpass;
lz->index = 0; lz->index = 0;
Py_RETURN_NONE; Py_RETURN_NONE;
} }

View File

@ -569,7 +569,7 @@ oss_setparameters(oss_audio_t *self, PyObject *args)
if (!_is_fd_valid(self->fd)) if (!_is_fd_valid(self->fd))
return NULL; return NULL;
if (!PyArg_ParseTuple(args, "iii|i:setparameters", if (!PyArg_ParseTuple(args, "iii|p:setparameters",
&wanted_fmt, &wanted_channels, &wanted_rate, &wanted_fmt, &wanted_channels, &wanted_rate,
&strict)) &strict))
return NULL; return NULL;

View File

@ -6324,9 +6324,9 @@ os.posix_spawn
A sequence of file action tuples. A sequence of file action tuples.
setpgroup: object = NULL setpgroup: object = NULL
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag. The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
resetids: bool(accept={int}) = False resetids: bool = False
If the value is `true` the POSIX_SPAWN_RESETIDS will be activated. If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
setsid: bool(accept={int}) = False setsid: bool = False
If the value is `true` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated. If the value is `true` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
setsigmask: object(c_default='NULL') = () setsigmask: object(c_default='NULL') = ()
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag. The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
@ -6344,7 +6344,7 @@ os_posix_spawn_impl(PyObject *module, path_t *path, PyObject *argv,
PyObject *setpgroup, int resetids, int setsid, PyObject *setpgroup, int resetids, int setsid,
PyObject *setsigmask, PyObject *setsigdef, PyObject *setsigmask, PyObject *setsigdef,
PyObject *scheduler) PyObject *scheduler)
/*[clinic end generated code: output=14a1098c566bc675 input=8c6305619a00ad04]*/ /*[clinic end generated code: output=14a1098c566bc675 input=808aed1090d84e33]*/
{ {
return py_posix_spawn(0, module, path, argv, env, file_actions, return py_posix_spawn(0, module, path, argv, env, file_actions,
setpgroup, resetids, setsid, setsigmask, setsigdef, setpgroup, resetids, setsid, setsigmask, setsigdef,
@ -6370,9 +6370,9 @@ os.posix_spawnp
A sequence of file action tuples. A sequence of file action tuples.
setpgroup: object = NULL setpgroup: object = NULL
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag. The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
resetids: bool(accept={int}) = False resetids: bool = False
If the value is `True` the POSIX_SPAWN_RESETIDS will be activated. If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
setsid: bool(accept={int}) = False setsid: bool = False
If the value is `True` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated. If the value is `True` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
setsigmask: object(c_default='NULL') = () setsigmask: object(c_default='NULL') = ()
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag. The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
@ -6390,7 +6390,7 @@ os_posix_spawnp_impl(PyObject *module, path_t *path, PyObject *argv,
PyObject *setpgroup, int resetids, int setsid, PyObject *setpgroup, int resetids, int setsid,
PyObject *setsigmask, PyObject *setsigdef, PyObject *setsigmask, PyObject *setsigdef,
PyObject *scheduler) PyObject *scheduler)
/*[clinic end generated code: output=7b9aaefe3031238d input=c1911043a22028da]*/ /*[clinic end generated code: output=7b9aaefe3031238d input=9e89e616116752a1]*/
{ {
return py_posix_spawn(1, module, path, argv, env, file_actions, return py_posix_spawn(1, module, path, argv, env, file_actions,
setpgroup, resetids, setsid, setsigmask, setsigdef, setpgroup, resetids, setsid, setsigmask, setsigdef,
@ -13528,7 +13528,7 @@ os_get_blocking_impl(PyObject *module, int fd)
/*[clinic input] /*[clinic input]
os.set_blocking os.set_blocking
fd: int fd: int
blocking: bool(accept={int}) blocking: bool
/ /
Set the blocking mode of the specified file descriptor. Set the blocking mode of the specified file descriptor.
@ -13539,7 +13539,7 @@ clear the O_NONBLOCK flag otherwise.
static PyObject * static PyObject *
os_set_blocking_impl(PyObject *module, int fd, int blocking) os_set_blocking_impl(PyObject *module, int fd, int blocking)
/*[clinic end generated code: output=384eb43aa0762a9d input=bf5c8efdc5860ff3]*/ /*[clinic end generated code: output=384eb43aa0762a9d input=7e9dfc9b14804dd4]*/
{ {
int result; int result;

View File

@ -710,7 +710,7 @@ pyexpat.xmlparser.Parse
cls: defining_class cls: defining_class
data: object data: object
isfinal: bool(accept={int}) = False isfinal: bool = False
/ /
Parse XML data. Parse XML data.
@ -721,7 +721,7 @@ Parse XML data.
static PyObject * static PyObject *
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls, pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
PyObject *data, int isfinal) PyObject *data, int isfinal)
/*[clinic end generated code: output=8faffe07fe1f862a input=fc97f833558ca715]*/ /*[clinic end generated code: output=8faffe07fe1f862a input=d0eb2a69fab3b9f1]*/
{ {
const char *s; const char *s;
Py_ssize_t slen; Py_ssize_t slen;

View File

@ -2928,8 +2928,8 @@ sock_setblocking(PySocketSockObject *s, PyObject *arg)
{ {
long block; long block;
block = PyLong_AsLong(arg); block = PyObject_IsTrue(arg);
if (block == -1 && PyErr_Occurred()) if (block < 0)
return NULL; return NULL;
s->sock_timeout = _PyTime_FromSeconds(block ? -1 : 0); s->sock_timeout = _PyTime_FromSeconds(block ? -1 : 0);

View File

@ -2012,7 +2012,7 @@ bytearray_join(PyByteArrayObject *self, PyObject *iterable_of_bytes)
/*[clinic input] /*[clinic input]
bytearray.splitlines bytearray.splitlines
keepends: bool(accept={int}) = False keepends: bool = False
Return a list of the lines in the bytearray, breaking at line boundaries. Return a list of the lines in the bytearray, breaking at line boundaries.
@ -2022,7 +2022,7 @@ true.
static PyObject * static PyObject *
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends) bytearray_splitlines_impl(PyByteArrayObject *self, int keepends)
/*[clinic end generated code: output=4223c94b895f6ad9 input=99a27ad959b9cf6b]*/ /*[clinic end generated code: output=4223c94b895f6ad9 input=66b2dcdea8d093bf]*/
{ {
return stringlib_splitlines( return stringlib_splitlines(
(PyObject*) self, PyByteArray_AS_STRING(self), (PyObject*) self, PyByteArray_AS_STRING(self),

View File

@ -2314,7 +2314,7 @@ bytes_decode_impl(PyBytesObject *self, const char *encoding,
/*[clinic input] /*[clinic input]
bytes.splitlines bytes.splitlines
keepends: bool(accept={int}) = False keepends: bool = False
Return a list of the lines in the bytes, breaking at line boundaries. Return a list of the lines in the bytes, breaking at line boundaries.
@ -2324,7 +2324,7 @@ true.
static PyObject * static PyObject *
bytes_splitlines_impl(PyBytesObject *self, int keepends) bytes_splitlines_impl(PyBytesObject *self, int keepends)
/*[clinic end generated code: output=3484149a5d880ffb input=a8b32eb01ff5a5ed]*/ /*[clinic end generated code: output=3484149a5d880ffb input=5d7b898af2fe55c0]*/
{ {
return stringlib_splitlines( return stringlib_splitlines(
(PyObject*) self, PyBytes_AS_STRING(self), (PyObject*) self, PyBytes_AS_STRING(self),

View File

@ -1084,8 +1084,8 @@ bytearray_splitlines(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
keepends = _PyLong_AsInt(args[0]); keepends = PyObject_IsTrue(args[0]);
if (keepends == -1 && PyErr_Occurred()) { if (keepends < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -1287,4 +1287,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{ {
return bytearray_sizeof_impl(self); return bytearray_sizeof_impl(self);
} }
/*[clinic end generated code: output=72bfa6cac2fd6832 input=a9049054013a1b77]*/ /*[clinic end generated code: output=022698e8b0faa272 input=a9049054013a1b77]*/

View File

@ -839,8 +839,8 @@ bytes_splitlines(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
keepends = _PyLong_AsInt(args[0]); keepends = PyObject_IsTrue(args[0]);
if (keepends == -1 && PyErr_Occurred()) { if (keepends < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -1063,4 +1063,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=5e0a25b7ba749a04 input=a9049054013a1b77]*/ /*[clinic end generated code: output=31a9e4af85562612 input=a9049054013a1b77]*/

View File

@ -215,8 +215,8 @@ list_sort(PyListObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
} }
reverse = _PyLong_AsInt(args[1]); reverse = PyObject_IsTrue(args[1]);
if (reverse == -1 && PyErr_Occurred()) { if (reverse < 0) {
goto exit; goto exit;
} }
skip_optional_kwonly: skip_optional_kwonly:
@ -382,4 +382,4 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored))
{ {
return list___reversed___impl(self); return list___reversed___impl(self);
} }
/*[clinic end generated code: output=782ed6c68b1c9f83 input=a9049054013a1b77]*/ /*[clinic end generated code: output=4e6f38b655394564 input=a9049054013a1b77]*/

View File

@ -1193,8 +1193,8 @@ unicode_splitlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
keepends = _PyLong_AsInt(args[0]); keepends = PyObject_IsTrue(args[0]);
if (keepends == -1 && PyErr_Occurred()) { if (keepends < 0) {
goto exit; goto exit;
} }
skip_optional_pos: skip_optional_pos:
@ -1497,4 +1497,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=e775ff4154f1c935 input=a9049054013a1b77]*/ /*[clinic end generated code: output=05d942840635dadf input=a9049054013a1b77]*/

View File

@ -2227,7 +2227,7 @@ list.sort
* *
key as keyfunc: object = None key as keyfunc: object = None
reverse: bool(accept={int}) = False reverse: bool = False
Sort the list in ascending order and return None. Sort the list in ascending order and return None.
@ -2242,7 +2242,7 @@ The reverse flag can be set to sort in descending order.
static PyObject * static PyObject *
list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
/*[clinic end generated code: output=57b9f9c5e23fbe42 input=cb56cd179a713060]*/ /*[clinic end generated code: output=57b9f9c5e23fbe42 input=a74c4cd3ec6b5c08]*/
{ {
MergeState ms; MergeState ms;
Py_ssize_t nremaining; Py_ssize_t nremaining;

View File

@ -12444,7 +12444,7 @@ unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic input] /*[clinic input]
str.splitlines as unicode_splitlines str.splitlines as unicode_splitlines
keepends: bool(accept={int}) = False keepends: bool = False
Return a list of the lines in the string, breaking at line boundaries. Return a list of the lines in the string, breaking at line boundaries.
@ -12454,7 +12454,7 @@ true.
static PyObject * static PyObject *
unicode_splitlines_impl(PyObject *self, int keepends) unicode_splitlines_impl(PyObject *self, int keepends)
/*[clinic end generated code: output=f664dcdad153ec40 input=b508e180459bdd8b]*/ /*[clinic end generated code: output=f664dcdad153ec40 input=ba6ad05ee85d2b55]*/
{ {
return PyUnicode_Splitlines(self, keepends); return PyUnicode_Splitlines(self, keepends);
} }

View File

@ -714,7 +714,7 @@ compile as builtin_compile
filename: object(converter="PyUnicode_FSDecoder") filename: object(converter="PyUnicode_FSDecoder")
mode: str mode: str
flags: int = 0 flags: int = 0
dont_inherit: bool(accept={int}) = False dont_inherit: bool = False
optimize: int = -1 optimize: int = -1
* *
_feature_version as feature_version: int = -1 _feature_version as feature_version: int = -1
@ -737,7 +737,7 @@ static PyObject *
builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
const char *mode, int flags, int dont_inherit, const char *mode, int flags, int dont_inherit,
int optimize, int feature_version) int optimize, int feature_version)
/*[clinic end generated code: output=b0c09c84f116d3d7 input=40171fb92c1d580d]*/ /*[clinic end generated code: output=b0c09c84f116d3d7 input=cc78e20e7c7682ba]*/
{ {
PyObject *source_copy; PyObject *source_copy;
const char *str; const char *str;

View File

@ -354,8 +354,8 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[4]) { if (args[4]) {
dont_inherit = _PyLong_AsInt(args[4]); dont_inherit = PyObject_IsTrue(args[4]);
if (dont_inherit == -1 && PyErr_Occurred()) { if (dont_inherit < 0) {
goto exit; goto exit;
} }
if (!--noptargs) { if (!--noptargs) {
@ -1215,4 +1215,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=3c9497e0ffeb8a30 input=a9049054013a1b77]*/ /*[clinic end generated code: output=973da43fa65aa727 input=a9049054013a1b77]*/