[Numpy-svn] r6467 - in branches/1.2.x/numpy/core: src tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Feb 25 00:27:47 EST 2009
Author: oliphant
Date: 2009-02-24 23:27:46 -0600 (Tue, 24 Feb 2009)
New Revision: 6467
Modified:
branches/1.2.x/numpy/core/src/scalartypes.inc.src
branches/1.2.x/numpy/core/tests/test_regression.py
Log:
Patch 1.2.x branch with titles fix.
Modified: branches/1.2.x/numpy/core/src/scalartypes.inc.src
===================================================================
--- branches/1.2.x/numpy/core/src/scalartypes.inc.src 2009-02-25 05:15:47 UTC (rev 6466)
+++ branches/1.2.x/numpy/core/src/scalartypes.inc.src 2009-02-25 05:27:46 UTC (rev 6467)
@@ -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.2.x/numpy/core/tests/test_regression.py
===================================================================
--- branches/1.2.x/numpy/core/tests/test_regression.py 2009-02-25 05:15:47 UTC (rev 6466)
+++ branches/1.2.x/numpy/core/tests/test_regression.py 2009-02-25 05:27:46 UTC (rev 6467)
@@ -1209,5 +1209,13 @@
a = np.array(1)
self.failUnlessRaises(ValueError, lambda x: x.choose([]), a)
+ 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__":
run_module_suite()
More information about the Numpy-svn
mailing list