Commit a4fb856a authored by Stefan Behnel's avatar Stefan Behnel

Also fix module refcounting for #1764 and remove redundant variable assignment...

Also fix module refcounting for #1764 and remove redundant variable assignment (which just triggers a useless type check).
parent e8a6ad76
...@@ -680,12 +680,11 @@ static PyObject* __Pyx__ImportNumPyArray(void) { ...@@ -680,12 +680,11 @@ static PyObject* __Pyx__ImportNumPyArray(void) {
numpy_module = __Pyx_Import(PYIDENT("numpy"), NULL, 0); numpy_module = __Pyx_Import(PYIDENT("numpy"), NULL, 0);
if (likely(numpy_module)) { if (likely(numpy_module)) {
ndarray_object = PyObject_GetAttrString(numpy_module, "ndarray"); ndarray_object = PyObject_GetAttrString(numpy_module, "ndarray");
Py_DECREF(numpy_module);
} }
if (unlikely(!ndarray_object)) { if (unlikely(!ndarray_object)) {
// ImportError, AttributeError, ... // ImportError, AttributeError, ...
PyErr_Clear(); PyErr_Clear();
Py_INCREF(Py_None);
ndarray_object = Py_None;
} }
if (unlikely(!ndarray_object || !PyObject_TypeCheck(ndarray_object, &PyType_Type))) { if (unlikely(!ndarray_object || !PyObject_TypeCheck(ndarray_object, &PyType_Type))) {
Py_XDECREF(ndarray_object); Py_XDECREF(ndarray_object);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment