diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 6 | ||||
-rw-r--r-- | numpy/core/src/multiarray/descriptor.c | 6 | ||||
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 10 |
3 files changed, 20 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index bffe9f332..a5e3c96bc 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -1394,7 +1394,13 @@ static void PyObject *new, *args; /* call out to the Python builtin given by convstr */ args = Py_BuildValue("(N)", temp); +#if defined(NPY_PY3K) +#define PyInt_Type PyLong_Type +#endif new = Py@convstr@_Type.tp_new(&Py@convstr@_Type, args, NULL); +#if defined(NPY_PY3K) +#undef PyInt_Type +#endif Py_DECREF(args); temp = new; if (temp == NULL) { diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c index 2f1028124..8f29fab29 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -1122,12 +1122,18 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at) } } check_num = PyArray_OBJECT; +#if !defined(NPY_PY3K) if (obj == (PyObject *)(&PyInt_Type)) { check_num = PyArray_LONG; } else if (obj == (PyObject *)(&PyLong_Type)) { check_num = PyArray_LONGLONG; } +#else + if (obj == (PyObject *)(&PyLong_Type)) { + check_num = PyArray_LONG; + } +#endif else if (obj == (PyObject *)(&PyFloat_Type)) { check_num = PyArray_DOUBLE; } diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index 9e5edbf3c..67110dc17 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -2755,9 +2755,11 @@ setup_scalartypes(PyObject *NPY_UNUSED(dict)) if (PyType_Ready(&PyBool_Type) < 0) { return -1; } +#if !defined(NPY_PY3K) if (PyType_Ready(&PyInt_Type) < 0) { return -1; } +#endif if (PyType_Ready(&PyFloat_Type) < 0) { return -1; } @@ -2829,13 +2831,17 @@ setup_scalartypes(PyObject *NPY_UNUSED(dict)) SINGLE_INHERIT(Bool, Generic); SINGLE_INHERIT(Byte, SignedInteger); SINGLE_INHERIT(Short, SignedInteger); -#if SIZEOF_INT == SIZEOF_LONG +#if SIZEOF_INT == SIZEOF_LONG && !defined(NPY_PY3K) DUAL_INHERIT(Int, Int, SignedInteger); #else SINGLE_INHERIT(Int, SignedInteger); #endif +#if !defined(NPY_PY3K) DUAL_INHERIT(Long, Int, SignedInteger); -#if SIZEOF_LONGLONG == SIZEOF_LONG +#else + SINGLE_INHERIT(Long, SignedInteger); +#endif +#if SIZEOF_LONGLONG == SIZEOF_LONG && !defined(NPY_PY3K) DUAL_INHERIT(LongLong, Int, SignedInteger); #else SINGLE_INHERIT(LongLong, SignedInteger); |