summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2012-06-11 22:09:47 +0200
committerCharles Harris <charlesr.harris@gmail.com>2012-07-13 10:00:21 -0600
commitce0a7912e2e909cae4c4d2fc6d9745a97d2161c2 (patch)
treeb7ce6f9ed2cbdebc7bde5b4fdb35501aa2e31b95
parentafcc4cd5c645a4abdfa789f688a1e9f9f81762af (diff)
downloadnumpy-ce0a7912e2e909cae4c4d2fc6d9745a97d2161c2.tar.gz
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.
-rw-r--r--numpy/core/include/numpy/npy_3kcompat.h8
-rw-r--r--numpy/core/include/numpy/npy_common.h2
2 files changed, 8 insertions, 2 deletions
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
@@ -149,6 +149,14 @@ PyUnicode_Concat2(PyObject **left, PyObject *right)
#endif
/*
+ * PyIndex_Check
+ */
+#if (PY_VERSION_HEX < 0x02050000)
+#undef PyIndex_Check
+#define PyIndex_Check(o) 0
+#endif
+
+/*
* PyFile_* compatibility
*/
#if defined(NPY_PY3K)
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