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

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Aug 24 12:13:02 EDT 2006


Author: oliphant
Date: 2006-08-24 11:12:59 -0500 (Thu, 24 Aug 2006)
New Revision: 3058

Modified:
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
Log:
Remove automatic setting of tp_free and tp_hash when it could be a Python function

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-08-24 15:55:15 UTC (rev 3057)
+++ trunk/numpy/core/src/arrayobject.c	2006-08-24 16:12:59 UTC (rev 3058)
@@ -6620,7 +6620,7 @@
         (initproc)0,                              /* tp_init */
         array_alloc,                              /* tp_alloc */
         (newfunc)array_new,                       /* tp_new */
-        _pya_free,                                /* tp_free */
+        0,                                        /* tp_free */
         0,                                        /* tp_is_gc */
         0,                                        /* tp_bases */
         0,                                        /* tp_mro */
@@ -10289,7 +10289,7 @@
         (initproc)0,                              /* tp_init */
         0,                                        /* tp_alloc */
         arraymultiter_new,                        /* tp_new */
-        _pya_free,                                /* tp_free */
+        0,                                        /* tp_free */
         0,                                        /* tp_is_gc */
         0,                                        /* tp_bases */
         0,                                        /* tp_mro */
@@ -11166,7 +11166,7 @@
         0,                                      /* tp_as_number */
         0,                                      /* tp_as_sequence */
         &descr_as_mapping,                      /* tp_as_mapping */
-        (hashfunc)_Py_HashPointer,              /* tp_hash */
+        0,                                      /* tp_hash */
         0,                                      /* tp_call */
         (reprfunc)arraydescr_str,               /* tp_str */
         0,                                      /* tp_getattro */

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-08-24 15:55:15 UTC (rev 3057)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-08-24 16:12:59 UTC (rev 3058)
@@ -6435,7 +6435,7 @@
 static PyObject *
 test_interrupt(PyObject *self)
 {
-        int a = 0;
+        npy_ulonglong a = 0;
         NPY_SIGINT_ON
 
         while(1) {
@@ -6444,7 +6444,7 @@
 
         NPY_SIGINT_OFF
             
-        return PyInt_FromLong(a);
+        return PyLong_FromUnsignedLongLong(a);
 }
 #endif
 
@@ -6682,22 +6682,25 @@
 	d = PyModule_GetDict(m);
 	if (!d) goto err;
 
+	PyArray_Type.tp_free = _pya_free;
 	if (PyType_Ready(&PyArray_Type) < 0)
-                return;
+		return;
 
-        if (setup_scalartypes(d) < 0) goto err;
+	if (setup_scalartypes(d) < 0) goto err;
 
 	PyArrayIter_Type.tp_iter = PyObject_SelfIter;
 	PyArrayMultiIter_Type.tp_iter = PyObject_SelfIter;
+	PyArrayMultiIter_Type.tp_free = _pya_free;
 	if (PyType_Ready(&PyArrayIter_Type) < 0)
 		return;
 
 	if (PyType_Ready(&PyArrayMapIter_Type) < 0)
-                return;
+		return;
 
 	if (PyType_Ready(&PyArrayMultiIter_Type) < 0)
 		return;
 
+	PyArrayDescr_Type.tp_hash = (hashfunc)_Py_HashPointer;
 	if (PyType_Ready(&PyArrayDescr_Type) < 0)
 		return;
 
@@ -6739,11 +6742,11 @@
 	PyDict_SetItemString(d, "MAXDIMS", s);
 	Py_DECREF(s);
 
-        Py_INCREF(&PyArray_Type);
+	Py_INCREF(&PyArray_Type);
 	PyDict_SetItemString(d, "ndarray", (PyObject *)&PyArray_Type);
-        Py_INCREF(&PyArrayIter_Type);
+	Py_INCREF(&PyArrayIter_Type);
 	PyDict_SetItemString(d, "flatiter", (PyObject *)&PyArrayIter_Type);
-        Py_INCREF(&PyArrayMultiIter_Type);
+	Py_INCREF(&PyArrayMultiIter_Type);
 	PyDict_SetItemString(d, "broadcast",
 			     (PyObject *)&PyArrayMultiIter_Type);
 	Py_INCREF(&PyArrayDescr_Type);
@@ -6752,7 +6755,7 @@
 	Py_INCREF(&PyArrayFlags_Type);
 	PyDict_SetItemString(d, "flagsobj", (PyObject *)&PyArrayFlags_Type);
 
-        set_flaginfo(d);
+	set_flaginfo(d);
 
 	if (set_typeinfo(d) != 0) goto err;
 




More information about the Numpy-svn mailing list