[Numpy-svn] r6468 - in branches/1.1.x/numpy/core: src tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Feb 25 00:29:37 EST 2009
Author: oliphant
Date: 2009-02-24 23:29:33 -0600 (Tue, 24 Feb 2009)
New Revision: 6468
Modified:
branches/1.1.x/numpy/core/src/scalartypes.inc.src
branches/1.1.x/numpy/core/tests/test_regression.py
Log:
Patch 1.1.x branch with fix to void getitem when field-names have titles.
Modified: branches/1.1.x/numpy/core/src/scalartypes.inc.src
===================================================================
--- branches/1.1.x/numpy/core/src/scalartypes.inc.src 2009-02-25 05:27:46 UTC (rev 6467)
+++ branches/1.1.x/numpy/core/src/scalartypes.inc.src 2009-02-25 05:29:33 UTC (rev 6468)
@@ -1211,9 +1211,11 @@
static PyObject *
voidtype_getfield(PyVoidScalarObject *self, PyObject *args, PyObject *kwds)
{
- PyObject *ret;
+ PyObject *ret, *newargs;
- ret = gentype_generic_method((PyObject *)self, args, kwds, "getfield");
+ newargs = PyTuple_GetSlice(args, 0, 2);
+ ret = gentype_generic_method((PyObject *)self, newargs, kwds, "getfield");
+ Py_DECREF(newargs);
if (!ret) return ret;
if (PyArray_IsScalar(ret, Generic) && \
(!PyArray_IsScalar(ret, Void))) {
Modified: branches/1.1.x/numpy/core/tests/test_regression.py
===================================================================
--- branches/1.1.x/numpy/core/tests/test_regression.py 2009-02-25 05:27:46 UTC (rev 6467)
+++ branches/1.1.x/numpy/core/tests/test_regression.py 2009-02-25 05:29:33 UTC (rev 6468)
@@ -1095,5 +1095,13 @@
assert_equal(have, want)
+ def test_void_scalar_with_titles(self, level=rlevel):
+ """No ticket"""
+ data = [('john', 4), ('mary', 5)]
+ dtype1 = [(('source:yy', 'name'), 'O'), (('source:xx', 'id'), int)]
+ arr = array(data, dtype=dtype1)
+ assert arr[0][0] == 'john'
+ assert arr[0][1] == 4
+
if __name__ == "__main__":
NumpyTest().run()
More information about the Numpy-svn
mailing list