From: <md...@us...> - 2008-05-02 16:56:11
|
Revision: 5104 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5104&view=rev Author: mdboom Date: 2008-05-02 09:55:59 -0700 (Fri, 02 May 2008) Log Message: ----------- Update _subprocess.c from upstream Python 2.5.2 to get a few memory and reference-counting-related bugfixes. See bug 1949978. - MGD Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/src/_subprocess.c Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-01 18:38:28 UTC (rev 5103) +++ branches/v0_91_maint/CHANGELOG 2008-05-02 16:55:59 UTC (rev 5104) @@ -1,3 +1,7 @@ +2008-05-02 Update _subprocess.c from upstream Python 2.5.2 to get a + few memory and reference-counting-related bugfixes. See + bug 1949978. - MGD + 2008-04-29 Fix bug in mlab.sqrtm - MM 2008-04-28 Fix bug in SVG text with Mozilla-based viewers (the symbol Modified: branches/v0_91_maint/src/_subprocess.c =================================================================== --- branches/v0_91_maint/src/_subprocess.c 2008-05-01 18:38:28 UTC (rev 5103) +++ branches/v0_91_maint/src/_subprocess.c 2008-05-02 16:55:59 UTC (rev 5104) @@ -104,12 +104,12 @@ { if (self->handle != INVALID_HANDLE_VALUE) CloseHandle(self->handle); - PyMem_DEL(self); + PyObject_FREE(self); } static PyMethodDef sp_handle_methods[] = { - {"Detach", (PyCFunction) sp_handle_detach, 1}, - {"Close", (PyCFunction) sp_handle_close, 1}, + {"Detach", (PyCFunction) sp_handle_detach, METH_VARARGS}, + {"Close", (PyCFunction) sp_handle_close, METH_VARARGS}, {NULL, NULL} }; @@ -250,19 +250,23 @@ getint(PyObject* obj, char* name) { PyObject* value; + int ret; value = PyObject_GetAttrString(obj, name); if (! value) { PyErr_Clear(); /* FIXME: propagate error? */ return 0; } - return (int) PyInt_AsLong(value); + ret = (int) PyInt_AsLong(value); + Py_DECREF(value); + return ret; } static HANDLE gethandle(PyObject* obj, char* name) { sp_handle_object* value; + HANDLE ret; value = (sp_handle_object*) PyObject_GetAttrString(obj, name); if (! value) { @@ -270,8 +274,11 @@ return NULL; } if (value->ob_type != &sp_handle_type) - return NULL; - return value->handle; + ret = NULL; + else + ret = value->handle; + Py_DECREF(value); + return ret; } static PyObject* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |