summaryrefslogtreecommitdiff
path: root/numpy/f2py/src/fortranobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py/src/fortranobject.c')
-rw-r--r--numpy/f2py/src/fortranobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c
index 8ec5b510f..644339218 100644
--- a/numpy/f2py/src/fortranobject.c
+++ b/numpy/f2py/src/fortranobject.c
@@ -260,8 +260,11 @@ static PyObject *
fortran_getattr(PyFortranObject *fp, char *name) {
int i,j,k,flag;
if (fp->dict != NULL) {
- PyObject *v = PyDict_GetItemString(fp->dict, name);
- if (v != NULL) {
+ PyObject *v = _PyDict_GetItemStringWithError(fp->dict, name);
+ if (v == NULL && PyErr_Occurred()) {
+ return NULL;
+ }
+ else if (v != NULL) {
Py_INCREF(v);
return v;
}