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

numpy-svn@scip... numpy-svn@scip...
Fri Oct 26 16:39:11 CDT 2007


Author: oliphant
Date: 2007-10-26 16:39:08 -0500 (Fri, 26 Oct 2007)
New Revision: 4314

Modified:
   trunk/numpy/core/src/scalartypes.inc.src
Log:
Finish fixing ticket #600

Modified: trunk/numpy/core/src/scalartypes.inc.src
===================================================================
--- trunk/numpy/core/src/scalartypes.inc.src	2007-10-26 21:26:22 UTC (rev 4313)
+++ trunk/numpy/core/src/scalartypes.inc.src	2007-10-26 21:39:08 UTC (rev 4314)
@@ -1286,7 +1286,7 @@
 			tmp = _pya_malloc(buflen*2);
 			if (tmp == NULL) {
 				Py_DECREF(ret);
-				return Py_NoMemory();
+				return PyErr_NoMemory();
 			}
 			alloc = 1;
 			newlen = PyUCS2Buffer_AsUCS4((Py_UNICODE *)buffer,
@@ -1299,12 +1299,14 @@
                 mod = PyString_FromStringAndSize(buffer, buflen);
 		if (mod == NULL) {
 			Py_DECREF(ret);
-			return Py_NoMemory();
+			ret = NULL;
+			goto fail;
 		}
                 PyTuple_SET_ITEM(ret, 1,
                                  Py_BuildValue("NN", obj, mod));
+	fail:
 #ifndef Py_UNICODE_WIDE
-		if (alloc) _pya_free(buffer);
+		if (alloc) _pya_free((char *)buffer);
 #endif
         }
         return ret;



More information about the Numpy-svn mailing list