summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-05-30 06:49:47 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-05-30 06:49:47 (GMT)
commitd99bee7c9fb1211efc8e8e85083f0ca46c784500 (patch)
tree4822d3ff1840a50e91fefdd1675dc9675ac3376b /Objects
parent65856600ed74b59d6e3428f3fd24d39d60d40bbb (diff)
downloadcpython-d99bee7c9fb1211efc8e8e85083f0ca46c784500.zip
cpython-d99bee7c9fb1211efc8e8e85083f0ca46c784500.tar.gz
cpython-d99bee7c9fb1211efc8e8e85083f0ca46c784500.tar.bz2
Issue 2855: Fix obscure crasher by slowing down the entire module. Mimics what was done to dictionaries in r59223.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/setobject.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index f63aa75..5e8e05d 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -94,7 +94,9 @@ set_lookkey(PySetObject *so, PyObject *key, register long hash)
else {
if (entry->hash == hash) {
startkey = entry->key;
+ Py_INCREF(startkey);
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
+ Py_DECREF(startkey);
if (cmp < 0)
return NULL;
if (table == so->table && entry->key == startkey) {
@@ -125,7 +127,9 @@ set_lookkey(PySetObject *so, PyObject *key, register long hash)
break;
if (entry->hash == hash && entry->key != dummy) {
startkey = entry->key;
+ Py_INCREF(startkey);
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
+ Py_DECREF(startkey);
if (cmp < 0)
return NULL;
if (table == so->table && entry->key == startkey) {