[Python-checkins] CVS: python/dist/src/Objects abstract.c,2.93.6.2,2.93.6.3
Michael Hudson
mwh@users.sourceforge.net
Mon, 11 Mar 2002 02:13:01 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv3846
Modified Files:
Tag: release22-maint
abstract.c
Log Message:
Probably should have merged the two checkins to this file (oh well).
backport jhylton's checkin of
revision 2.98 of abstract.c
Fix leak of NotImplemented in previous checkin to PyNumber_Add().
If result == Py_NotImplemented, always DECREF it before assigning a
new value to result.
Index: abstract.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v
retrieving revision 2.93.6.2
retrieving revision 2.93.6.3
diff -C2 -d -r2.93.6.2 -r2.93.6.3
*** abstract.c 11 Mar 2002 10:11:46 -0000 2.93.6.2
--- abstract.c 11 Mar 2002 10:12:58 -0000 2.93.6.3
***************
*** 606,619 ****
if (result == Py_NotImplemented) {
PySequenceMethods *m = v->ob_type->tp_as_sequence;
! Py_DECREF(result);
! if (m && m->sq_concat)
result = (*m->sq_concat)(v, w);
if (result == Py_NotImplemented) {
! PyErr_Format(
PyExc_TypeError,
"unsupported operand types for +: '%s' and '%s'",
v->ob_type->tp_name,
w->ob_type->tp_name);
! result = NULL;
}
}
--- 606,621 ----
if (result == Py_NotImplemented) {
PySequenceMethods *m = v->ob_type->tp_as_sequence;
! if (m && m->sq_concat) {
! Py_DECREF(result);
result = (*m->sq_concat)(v, w);
+ }
if (result == Py_NotImplemented) {
! Py_DECREF(result);
! PyErr_Format(
PyExc_TypeError,
"unsupported operand types for +: '%s' and '%s'",
v->ob_type->tp_name,
w->ob_type->tp_name);
! result = NULL;
}
}