diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2011-12-04 12:01:25 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-12-04 12:01:25 -0700 |
commit | e9c42cab112d94dbcade9f1afc64b26af0521e14 (patch) | |
tree | e478c841164c9d1e3c6b1bd5f50c8f680c4b5347 | |
parent | eb46577e7be25d0a578d6275683ae6f28ac8ae06 (diff) | |
download | numpy-e9c42cab112d94dbcade9f1afc64b26af0521e14.tar.gz |
BUG: Check for NULL pointer before calling PyCObject_Check or
PyCapsule_CheckExact. This may be a Python bug but we might as
well check anyway. Reported by Geoffrey Irving.
-rw-r--r-- | numpy/core/include/numpy/npy_3kcompat.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/include/numpy/npy_3kcompat.h b/numpy/core/include/numpy/npy_3kcompat.h index 036ee3ac9..b6d3adfcb 100644 --- a/numpy/core/include/numpy/npy_3kcompat.h +++ b/numpy/core/include/numpy/npy_3kcompat.h @@ -345,7 +345,7 @@ NpyCapsule_GetDesc(PyObject *obj) static NPY_INLINE int NpyCapsule_Check(PyObject *ptr) { - return PyCapsule_CheckExact(ptr); + return ptr && PyCapsule_CheckExact(ptr); } static NPY_INLINE void @@ -384,7 +384,7 @@ NpyCapsule_GetDesc(PyObject *obj) static NPY_INLINE int NpyCapsule_Check(PyObject *ptr) { - return PyCObject_Check(ptr); + return ptr && PyCObject_Check(ptr); } static NPY_INLINE void |