Mercurial > cpython-lru_cache-weakref
diff Objects/setobject.c @ 47386:ea273c8e3eaa legacy-trunk
Issue 2855: Fix obscure crasher by slowing down the entire module. Mimics what was done to dictionaries in r59223.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 30 May 2008 06:49:47 +0000 |
| parents | 4fe192d48960 |
| children | 52294af4b663 |
line wrap: on
line diff
--- a/Objects/setobject.c Fri May 30 06:37:27 2008 +0000 +++ b/Objects/setobject.c Fri May 30 06:49:47 2008 +0000 @@ -94,7 +94,9 @@ 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 @@ 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) {
