[Python-checkins] cpython: Use PyArg_ParseTuple (new API) instead of PyArg_Parse (old API) for parsing

serhiy.storchaka python-checkins at python.org
Sun Apr 19 19:48:39 CEST 2015


https://hg.python.org/cpython/rev/cb619f1c616b
changeset:   95713:cb619f1c616b
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Apr 19 20:38:19 2015 +0300
summary:
  Use PyArg_ParseTuple (new API) instead of PyArg_Parse (old API) for parsing tuples.

files:
  Modules/_io/textio.c |  10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -538,7 +538,7 @@
            _PyIO_str_getstate, NULL);
         if (state == NULL)
             return NULL;
-        if (!PyArg_Parse(state, "(OK)", &buffer, &flag)) {
+        if (!PyArg_ParseTuple(state, "OK", &buffer, &flag)) {
             Py_DECREF(state);
             return NULL;
         }
@@ -569,7 +569,7 @@
     PyObject *buffer;
     unsigned PY_LONG_LONG flag;
 
-    if (!PyArg_Parse(state, "(OK)", &buffer, &flag))
+    if (!PyArg_ParseTuple(state, "OK", &buffer, &flag))
         return NULL;
 
     self->pendingcr = (int) (flag & 1);
@@ -1449,7 +1449,7 @@
         /* Given this, we know there was a valid snapshot point
          * len(dec_buffer) bytes ago with decoder state (b'', dec_flags).
          */
-        if (PyArg_Parse(state, "(OO)", &dec_buffer, &dec_flags) < 0) {
+        if (PyArg_ParseTuple(state, "OO", &dec_buffer, &dec_flags) < 0) {
             Py_DECREF(state);
             return -1;
         }
@@ -2305,7 +2305,7 @@
         goto fail;
 
     /* Skip backward to the snapshot point (see _read_chunk). */
-    if (!PyArg_Parse(self->snapshot, "(iO)", &cookie.dec_flags, &next_input))
+    if (!PyArg_ParseTuple(self->snapshot, "iO", &cookie.dec_flags, &next_input))
         goto fail;
 
     assert (PyBytes_Check(next_input));
@@ -2331,7 +2331,7 @@
             _PyIO_str_getstate, NULL); \
         if (_state == NULL) \
             goto fail; \
-        if (!PyArg_Parse(_state, "(y#i)", &dec_buffer, &dec_buffer_len, &dec_flags)) { \
+        if (!PyArg_ParseTuple(_state, "y#i", &dec_buffer, &dec_buffer_len, &dec_flags)) { \
             Py_DECREF(_state); \
             goto fail; \
         } \

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list