[Numpy-svn] r5361 - trunk/numpy/core/src
numpy-svn at scipy.org
numpy-svn at scipy.org
Tue Jul 8 13:02:20 EDT 2008
Author: oliphant
Date: 2008-07-08 12:02:15 -0500 (Tue, 08 Jul 2008)
New Revision: 5361
Modified:
trunk/numpy/core/src/multiarraymodule.c
Log:
Fix ref-count leak in Ticket #843
Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c 2008-07-08 08:24:37 UTC (rev 5360)
+++ trunk/numpy/core/src/multiarraymodule.c 2008-07-08 17:02:15 UTC (rev 5361)
@@ -2139,12 +2139,18 @@
if (scalar == PyArray_NOSCALAR) {
return PyArray_CanCastSafely(thistype, neededtype);
}
+
from = PyArray_DescrFromType(thistype);
if (from->f->cancastscalarkindto &&
(castlist = from->f->cancastscalarkindto[scalar])) {
while (*castlist != PyArray_NOTYPE)
- if (*castlist++ == neededtype) return 1;
+ if (*castlist++ == neededtype) {
+ Py_DECREF(from);
+ return 1;
+ }
}
+ Py_DECREF(from);
+
switch(scalar) {
case PyArray_BOOL_SCALAR:
case PyArray_OBJECT_SCALAR:
More information about the Numpy-svn
mailing list