]> granicus.if.org Git - python/commitdiff
Issue #8651: Fix "z#" format of PyArg_Parse*() function: the size was not
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 3 May 2011 13:06:11 +0000 (15:06 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 3 May 2011 13:06:11 +0000 (15:06 +0200)
written if PY_SSIZE_T_CLEAN is defined.

Misc/NEWS
Python/getargs.c

index 50f6aaf526158846e7b20a2b981e6a810f290908..e26b6ca316d71070754bb3896666f5b849656938 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,9 @@ What's New in Python 2.7.2?
 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
index 7c3e9fa38407e2848f09ab222f67a0c5c00cc91b..02351ed6fa0f8dcd73a0fb71e4079a7b5a599458 100644 (file)
@@ -984,10 +984,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
             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 &&