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

Skip to content

Commit b35f128

Browse files
committed
At least one of the buildbots was complaining about newview being used
without being initialized. Also make the code conform to the comment and return the new object. This code needs a test!
1 parent e43bd62 commit b35f128

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Objects/memoryobject.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,11 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
513513
else {
514514
/* Return a new memory-view object */
515515
Py_buffer newview;
516-
PyMemoryView_FromMemory(&newview);
516+
memset(&newview, 0, sizeof(newview));
517+
return PyMemoryView_FromMemory(&newview);
517518
}
518519
}
519520

520-
521-
522521
Py_INCREF(Py_NotImplemented);
523522
return Py_NotImplemented;
524523
}

0 commit comments

Comments
 (0)