Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb72c47

Browse files
Use PyArg_ParseTuple (new API) instead of PyArg_Parse (old API) for parsing tuples.
1 parent 5cc9c4f commit bb72c47

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Modules/_io/textio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ _io_IncrementalNewlineDecoder_getstate_impl(nldecoder_object *self)
538538
_PyIO_str_getstate, NULL);
539539
if (state == NULL)
540540
return NULL;
541-
if (!PyArg_Parse(state, "(OK)", &buffer, &flag)) {
541+
if (!PyArg_ParseTuple(state, "OK", &buffer, &flag)) {
542542
Py_DECREF(state);
543543
return NULL;
544544
}
@@ -569,7 +569,7 @@ _io_IncrementalNewlineDecoder_setstate(nldecoder_object *self,
569569
PyObject *buffer;
570570
unsigned PY_LONG_LONG flag;
571571

572-
if (!PyArg_Parse(state, "(OK)", &buffer, &flag))
572+
if (!PyArg_ParseTuple(state, "OK", &buffer, &flag))
573573
return NULL;
574574

575575
self->pendingcr = (int) (flag & 1);
@@ -1449,7 +1449,7 @@ textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
14491449
/* Given this, we know there was a valid snapshot point
14501450
* len(dec_buffer) bytes ago with decoder state (b'', dec_flags).
14511451
*/
1452-
if (PyArg_Parse(state, "(OO)", &dec_buffer, &dec_flags) < 0) {
1452+
if (PyArg_ParseTuple(state, "OO", &dec_buffer, &dec_flags) < 0) {
14531453
Py_DECREF(state);
14541454
return -1;
14551455
}
@@ -2305,7 +2305,7 @@ _io_TextIOWrapper_tell_impl(textio *self)
23052305
goto fail;
23062306

23072307
/* Skip backward to the snapshot point (see _read_chunk). */
2308-
if (!PyArg_Parse(self->snapshot, "(iO)", &cookie.dec_flags, &next_input))
2308+
if (!PyArg_ParseTuple(self->snapshot, "iO", &cookie.dec_flags, &next_input))
23092309
goto fail;
23102310

23112311
assert (PyBytes_Check(next_input));
@@ -2331,7 +2331,7 @@ _io_TextIOWrapper_tell_impl(textio *self)
23312331
_PyIO_str_getstate, NULL); \
23322332
if (_state == NULL) \
23332333
goto fail; \
2334-
if (!PyArg_Parse(_state, "(y#i)", &dec_buffer, &dec_buffer_len, &dec_flags)) { \
2334+
if (!PyArg_ParseTuple(_state, "y#i", &dec_buffer, &dec_buffer_len, &dec_flags)) { \
23352335
Py_DECREF(_state); \
23362336
goto fail; \
23372337
} \

0 commit comments

Comments
 (0)