Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c6fb33

Browse files
committed
Merged revisions 5102-5105 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint ........ r5104 | mdboom | 2008-05-02 12:55:59 -0400 (Fri, 02 May 2008) | 3 lines Update _subprocess.c from upstream Python 2.5.2 to get a few memory and reference-counting-related bugfixes. See bug 1949978. - MGD ........ svn path=/trunk/matplotlib/; revision=5106
1 parent 535d15c commit 4c6fb33

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2008-05-02 Update _subprocess.c from upstream Python 2.5.2 to get a
2+
few memory and reference-counting-related bugfixes. See
3+
bug 1949978. - MGD
4+
15
2008-04-30 Added some record array editing widgets for gtk -- see
26
examples/rec_edit*.py - JDH
37

src/_subprocess.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ sp_handle_dealloc(sp_handle_object* self)
104104
{
105105
if (self->handle != INVALID_HANDLE_VALUE)
106106
CloseHandle(self->handle);
107-
PyMem_DEL(self);
107+
PyObject_FREE(self);
108108
}
109109

110110
static PyMethodDef sp_handle_methods[] = {
111-
{"Detach", (PyCFunction) sp_handle_detach, 1},
112-
{"Close", (PyCFunction) sp_handle_close, 1},
111+
{"Detach", (PyCFunction) sp_handle_detach, METH_VARARGS},
112+
{"Close", (PyCFunction) sp_handle_close, METH_VARARGS},
113113
{NULL, NULL}
114114
};
115115

@@ -250,28 +250,35 @@ static int
250250
getint(PyObject* obj, char* name)
251251
{
252252
PyObject* value;
253+
int ret;
253254

254255
value = PyObject_GetAttrString(obj, name);
255256
if (! value) {
256257
PyErr_Clear(); /* FIXME: propagate error? */
257258
return 0;
258259
}
259-
return (int) PyInt_AsLong(value);
260+
ret = (int) PyInt_AsLong(value);
261+
Py_DECREF(value);
262+
return ret;
260263
}
261264

262265
static HANDLE
263266
gethandle(PyObject* obj, char* name)
264267
{
265268
sp_handle_object* value;
269+
HANDLE ret;
266270

267271
value = (sp_handle_object*) PyObject_GetAttrString(obj, name);
268272
if (! value) {
269273
PyErr_Clear(); /* FIXME: propagate error? */
270274
return NULL;
271275
}
272276
if (value->ob_type != &sp_handle_type)
273-
return NULL;
274-
return value->handle;
277+
ret = NULL;
278+
else
279+
ret = value->handle;
280+
Py_DECREF(value);
281+
return ret;
275282
}
276283

277284
static PyObject*

0 commit comments

Comments
 (0)