[Numpy-svn] r4704 - trunk/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Mon Jan 7 15:20:09 CST 2008


Author: oliphant
Date: 2008-01-07 15:20:06 -0600 (Mon, 07 Jan 2008)
New Revision: 4704

Modified:
   trunk/numpy/core/src/scalartypes.inc.src
Log:
Fix scalar __array_interface__ by making sure to retain a reference the 0-d array created in the returned dictionary.

Modified: trunk/numpy/core/src/scalartypes.inc.src
===================================================================
--- trunk/numpy/core/src/scalartypes.inc.src	2008-01-07 14:59:16 UTC (rev 4703)
+++ trunk/numpy/core/src/scalartypes.inc.src	2008-01-07 21:20:06 UTC (rev 4704)
@@ -863,6 +863,7 @@
         arr = (PyArrayObject *)PyArray_FromScalar(self, NULL);
         if (arr == NULL) return NULL;
         inter = PyObject_GetAttrString((PyObject *)arr, "__array_interface__");
+	if (inter != NULL) PyDict_SetItemString(inter, "__ref", (PyObject *)arr);
         Py_DECREF(arr);
         return inter;
 }



More information about the Numpy-svn mailing list