[Python-checkins] cpython (2.7): Issue #8651: Fix "z#" format of PyArg_Parse*() function: the size was not

victor.stinner python-checkins at python.org
Tue May 3 15:08:12 CEST 2011


http://hg.python.org/cpython/rev/509f1c15a1e1
changeset:   69798:509f1c15a1e1
branch:      2.7
parent:      69796:618c3e971e80
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Tue May 03 15:06:11 2011 +0200
summary:
  Issue #8651: Fix "z#" format of PyArg_Parse*() function: the size was not
written if PY_SSIZE_T_CLEAN is defined.

files:
  Misc/NEWS        |  3 +++
  Python/getargs.c |  9 +++++----
  2 files changed, 8 insertions(+), 4 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,9 @@
 Core and Builtins
 -----------------
 
+- Issue #8651: Fix "z#" format of PyArg_Parse*() function: the size was not
+  written if PY_SSIZE_T_CLEAN is defined.
+
 - Issue #9756: When calling a method descriptor or a slot wrapper descriptor,
   the check of the object type doesn't read the __class__ attribute anymore.
   Fix a crash if a class override its __class__ attribute (e.g. a proxy of the
diff --git a/Python/getargs.c b/Python/getargs.c
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -984,10 +984,11 @@
             if (*format == '#') {
                 FETCH_SIZE;
                 assert(0); /* XXX redundant with if-case */
-                if (arg == Py_None)
-                    *q = 0;
-                else
-                    *q = PyString_Size(arg);
+                if (arg == Py_None) {
+                    STORE_SIZE(0);
+                } else {
+                    STORE_SIZE(PyString_Size(arg));
+                }
                 format++;
             }
             else if (*p != NULL &&

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


More information about the Python-checkins mailing list