[Python-checkins] CVS: python/dist/src/Python ceval.c,2.292,2.293
Guido van Rossum
gvanrossum@users.sourceforge.net
Mon, 03 Dec 2001 11:45:10 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv21226
Modified Files:
ceval.c
Log Message:
Fix the final two issues in Armin Rigo's SF bug #488477: apply_slice()
and assign_slice() weren't properly DECREF'ing the temporary slice
object they created. (Shame on me. :-)
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.292
retrieving revision 2.293
diff -C2 -d -r2.292 -r2.293
*** ceval.c 2001/12/03 19:33:25 2.292
--- ceval.c 2001/12/03 19:45:06 2.293
***************
*** 3399,3404 ****
else {
PyObject *slice = PySlice_New(v, w, NULL);
! if (slice != NULL)
! return PyObject_GetItem(u, slice);
else
return NULL;
--- 3399,3407 ----
else {
PyObject *slice = PySlice_New(v, w, NULL);
! if (slice != NULL) {
! PyObject *res = PyObject_GetItem(u, slice);
! Py_DECREF(slice);
! return res;
! }
else
return NULL;
***************
*** 3427,3434 ****
PyObject *slice = PySlice_New(v, w, NULL);
if (slice != NULL) {
if (x != NULL)
! return PyObject_SetItem(u, slice, x);
else
! return PyObject_DelItem(u, slice);
}
else
--- 3430,3440 ----
PyObject *slice = PySlice_New(v, w, NULL);
if (slice != NULL) {
+ int res;
if (x != NULL)
! res = PyObject_SetItem(u, slice, x);
else
! res = PyObject_DelItem(u, slice);
! Py_DECREF(slice);
! return res;
}
else