]> granicus.if.org Git - python/commitdiff
At least one of the buildbots was complaining about newview being used
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 7 Oct 2007 19:26:50 +0000 (19:26 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 7 Oct 2007 19:26:50 +0000 (19:26 +0000)
without being initialized.  Also make the code conform to the comment and
return the new object.  This code needs a test!

Objects/memoryobject.c

index d06d7e505f5ce404dd6e1f100ae6c18a76728173..754cbc1fbd67102c3069f99dc57f5706e05e57b1 100644 (file)
@@ -513,12 +513,11 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
                else {
                        /* Return a new memory-view object */
                        Py_buffer newview;
-                       PyMemoryView_FromMemory(&newview);
+                       memset(&newview, 0, sizeof(newview));
+                       return PyMemoryView_FromMemory(&newview);
                }
        }
 
-
-
         Py_INCREF(Py_NotImplemented);
         return Py_NotImplemented;
 }