Skip to content

Commit

Permalink
ENH: Optimize array creation by avoiding errors
Browse files Browse the repository at this point in the history
  • Loading branch information
m-d-w committed Jun 6, 2013
1 parent 3f96717 commit f0cd760
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/common.c
Expand Up @@ -360,7 +360,7 @@ PyArray_DTypeFromObjectHelper(PyObject *obj, int maxdims,

/* PEP 3118 buffer interface */
if (SUPPORTS_BUFFER_PROTOCOL(obj) &&
PyObject_CheckBuffer(obj) == 1) {
PyObject_CheckBuffer(obj) == 1) {
memset(&buffer_view, 0, sizeof(Py_buffer));
if (PyObject_GetBuffer(obj, &buffer_view,
PyBUF_FORMAT|PyBUF_STRIDES) == 0 ||
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/ctors.c
Expand Up @@ -647,7 +647,7 @@ discover_dimensions(PyObject *obj, int *maxndim, npy_intp *d, int check_it,
#if PY_VERSION_HEX >= 0x02060000
/* PEP 3118 buffer interface */
if (SUPPORTS_BUFFER_PROTOCOL(obj) &&
PyObject_CheckBuffer(obj) == 1) {
PyObject_CheckBuffer(obj) == 1) {
memset(&buffer_view, 0, sizeof(Py_buffer));
if (PyObject_GetBuffer(obj, &buffer_view, PyBUF_STRIDES) == 0 ||
PyObject_GetBuffer(obj, &buffer_view, PyBUF_ND) == 0) {
Expand Down

0 comments on commit f0cd760

Please sign in to comment.