[Python-checkins] CVS: python/dist/src/Objects object.c,2.92,2.93
Vladimir Marangozov
python-dev@python.org
Thu, 10 Aug 2000 17:14:29 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19902/Objects
Modified Files:
object.c
Log Message:
Fix missing decrements of the recursive counter in PyObject_Compare().
Closes Patch #101065.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.92
retrieving revision 2.93
diff -C2 -r2.92 -r2.93
*** object.c 2000/08/04 15:36:13 2.92
--- object.c 2000/08/11 00:14:26 2.93
***************
*** 404,412 ****
if (!PyInstance_Check(v))
return -PyObject_Compare(w, v);
! if (++_PyCompareState_nesting > NESTING_LIMIT) {
PyObject *inprogress, *pair;
inprogress = get_inprogress_dict();
if (inprogress == NULL) {
return -1;
}
--- 404,414 ----
if (!PyInstance_Check(v))
return -PyObject_Compare(w, v);
! _PyCompareState_nesting++;
! if (_PyCompareState_nesting > NESTING_LIMIT) {
PyObject *inprogress, *pair;
inprogress = get_inprogress_dict();
if (inprogress == NULL) {
+ _PyCompareState_nesting--;
return -1;
}
***************
*** 416,427 ****
they're equal until shown otherwise */
Py_DECREF(pair);
! --_PyCompareState_nesting;
return 0;
}
if (PyDict_SetItem(inprogress, pair, pair) == -1) {
return -1;
}
res = do_cmp(v, w);
- _PyCompareState_nesting--;
/* XXX DelItem shouldn't fail */
PyDict_DelItem(inprogress, pair);
--- 418,429 ----
they're equal until shown otherwise */
Py_DECREF(pair);
! _PyCompareState_nesting--;
return 0;
}
if (PyDict_SetItem(inprogress, pair, pair) == -1) {
+ _PyCompareState_nesting--;
return -1;
}
res = do_cmp(v, w);
/* XXX DelItem shouldn't fail */
PyDict_DelItem(inprogress, pair);
***************
*** 430,433 ****
--- 432,436 ----
res = do_cmp(v, w);
}
+ _PyCompareState_nesting--;
if (res == NULL)
return -1;
***************
*** 487,491 ****
return (v < w) ? -1 : 1;
}
! if (++_PyCompareState_nesting > NESTING_LIMIT
&& (vtp->tp_as_mapping
|| (vtp->tp_as_sequence && !PyString_Check(v)))) {
--- 490,495 ----
return (v < w) ? -1 : 1;
}
! _PyCompareState_nesting++;
! if (_PyCompareState_nesting > NESTING_LIMIT
&& (vtp->tp_as_mapping
|| (vtp->tp_as_sequence && !PyString_Check(v)))) {
***************
*** 494,497 ****
--- 498,502 ----
inprogress = get_inprogress_dict();
if (inprogress == NULL) {
+ _PyCompareState_nesting--;
return -1;
}
***************
*** 500,512 ****
/* already comparing these objects. assume
they're equal until shown otherwise */
- _PyCompareState_nesting--;
Py_DECREF(pair);
return 0;
}
if (PyDict_SetItem(inprogress, pair, pair) == -1) {
return -1;
}
result = (*vtp->tp_compare)(v, w);
- _PyCompareState_nesting--;
PyDict_DelItem(inprogress, pair); /* XXX shouldn't fail */
Py_DECREF(pair);
--- 505,517 ----
/* already comparing these objects. assume
they're equal until shown otherwise */
Py_DECREF(pair);
+ _PyCompareState_nesting--;
return 0;
}
if (PyDict_SetItem(inprogress, pair, pair) == -1) {
+ _PyCompareState_nesting--;
return -1;
}
result = (*vtp->tp_compare)(v, w);
PyDict_DelItem(inprogress, pair); /* XXX shouldn't fail */
Py_DECREF(pair);
***************
*** 514,517 ****
--- 519,523 ----
result = (*vtp->tp_compare)(v, w);
}
+ _PyCompareState_nesting--;
return result;
}