From ce0a7912e2e909cae4c4d2fc6d9745a97d2161c2 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Mon, 11 Jun 2012 22:09:47 +0200 Subject: BUG: core: don't pollute public namespace with PyIndex_Check on Python 2.4 Public numpy headers shouldn't define a replacement PyIndex_Check. This causes unexpected behavior in Python2.4 in 3rd party code. --- numpy/core/include/numpy/npy_3kcompat.h | 8 ++++++++ numpy/core/include/numpy/npy_common.h | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'numpy') diff --git a/numpy/core/include/numpy/npy_3kcompat.h b/numpy/core/include/numpy/npy_3kcompat.h index 7bc94ebc8..e771187e5 100644 --- a/numpy/core/include/numpy/npy_3kcompat.h +++ b/numpy/core/include/numpy/npy_3kcompat.h @@ -148,6 +148,14 @@ PyUnicode_Concat2(PyObject **left, PyObject *right) #define Py_SIZE(o) (((PyVarObject*)(o))->ob_size) #endif +/* + * PyIndex_Check + */ +#if (PY_VERSION_HEX < 0x02050000) +#undef PyIndex_Check +#define PyIndex_Check(o) 0 +#endif + /* * PyFile_* compatibility */ diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h index aecc88783..7fca7e220 100644 --- a/numpy/core/include/numpy/npy_common.h +++ b/numpy/core/include/numpy/npy_common.h @@ -57,9 +57,7 @@ typedef Py_uintptr_t npy_uintp; #define PY_SSIZE_T_MIN INT_MIN #endif #define NPY_SSIZE_T_PYFMT "i" -#undef PyIndex_Check #define constchar const char -#define PyIndex_Check(op) 0 #else #define NPY_SSIZE_T_PYFMT "n" #define constchar char -- cgit v1.2.1