diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-08-19 08:41:19 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-08-27 07:26:57 -0600 |
commit | 2b72d06fdc8e29cc2906890038ede8d74f4327a1 (patch) | |
tree | b1ee8e1988f5db43902926b3e03f2b103ed6ebc6 /numpy | |
parent | 066f095cb8755a434dbbeb7ce265384b2d06b30b (diff) | |
download | numpy-2b72d06fdc8e29cc2906890038ede8d74f4327a1.tar.gz |
BLD: missingdata: Fixes for Python 3
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/descriptor.c | 16 | ||||
-rw-r--r-- | numpy/core/src/multiarray/na_singleton.c | 7 | ||||
-rw-r--r-- | numpy/core/tests/test_na.py | 1 |
3 files changed, 14 insertions, 10 deletions
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c index d5e937a67..17136597a 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -874,16 +874,16 @@ _convert_from_dict(PyObject *obj, int align) totalsize = 0; for (i = 0; i < n; i++) { - PyObject *tup, *descr, *index, *title, *name, *off; + PyObject *tup, *descr, *ind, *title, *name, *off; int len, ret, _align = 1; PyArray_Descr *newdescr; /* Build item to insert (descr, offset, [title])*/ len = 2; title = NULL; - index = PyInt_FromLong(i); + ind = PyInt_FromLong(i); if (titles) { - title=PyObject_GetItem(titles, index); + title=PyObject_GetItem(titles, ind); if (title && title != Py_None) { len = 3; } @@ -893,7 +893,7 @@ _convert_from_dict(PyObject *obj, int align) PyErr_Clear(); } tup = PyTuple_New(len); - descr = PyObject_GetItem(descrs, index); + descr = PyObject_GetItem(descrs, ind); if (!descr) { goto fail; } @@ -906,7 +906,7 @@ _convert_from_dict(PyObject *obj, int align) Py_DECREF(descr); if (ret == PY_FAIL) { Py_DECREF(tup); - Py_DECREF(index); + Py_DECREF(ind); goto fail; } PyTuple_SET_ITEM(tup, 0, (PyObject *)newdescr); @@ -916,7 +916,7 @@ _convert_from_dict(PyObject *obj, int align) } if (offsets) { long offset; - off = PyObject_GetItem(offsets, index); + off = PyObject_GetItem(offsets, ind); if (!off) { goto fail; } @@ -949,11 +949,11 @@ _convert_from_dict(PyObject *obj, int align) if (len == 3) { PyTuple_SET_ITEM(tup, 2, title); } - name = PyObject_GetItem(names, index); + name = PyObject_GetItem(names, ind); if (!name) { goto fail; } - Py_DECREF(index); + Py_DECREF(ind); #if defined(NPY_PY3K) if (!PyUString_Check(name)) { #else diff --git a/numpy/core/src/multiarray/na_singleton.c b/numpy/core/src/multiarray/na_singleton.c index 2b4002202..3347efcef 100644 --- a/numpy/core/src/multiarray/na_singleton.c +++ b/numpy/core/src/multiarray/na_singleton.c @@ -705,7 +705,12 @@ NPY_NO_EXPORT PyTypeObject NpyNA_Type = { 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES, /* tp_flags */ + Py_TPFLAGS_DEFAULT /* tp_flags */ +#if !defined(NPY_PY3K) + | Py_TPFLAGS_CHECKTYPES, +#else + , +#endif 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/numpy/core/tests/test_na.py b/numpy/core/tests/test_na.py index 676377ca1..ecec3b4cd 100644 --- a/numpy/core/tests/test_na.py +++ b/numpy/core/tests/test_na.py @@ -111,7 +111,6 @@ def test_na_other_operations(): assert_equal(type(np.NA / 2j), np.NAType) assert_equal(type(2j / np.NA), np.NAType) assert_equal(type(np.NA // 2j), np.NAType) - assert_equal(type(2j // np.NA), np.NAType) assert_equal(type(np.NA % 6), np.NAType) assert_equal(type(6 % np.NA), np.NAType) assert_equal(type(np.NA ** 2), np.NAType) |