]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Hoist the global "dummy" lookup outside of the reinsertion loop.
authorRaymond Hettinger <python@rcn.com>
Thu, 15 Aug 2013 09:18:55 +0000 (02:18 -0700)
committerRaymond Hettinger <python@rcn.com>
Thu, 15 Aug 2013 09:18:55 +0000 (02:18 -0700)
Objects/setobject.c

index eff91c566d17d1b8a320f73982d47c787e11db69..ac501b6000374afe8c8d65852bd756367f70bb9d 100644 (file)
@@ -280,6 +280,7 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
     Py_ssize_t i;
     int is_oldtable_malloced;
     setentry small_copy[PySet_MINSIZE];
+    PyObject *dummy_entry;
 
     assert(minused >= 0);
 
@@ -336,11 +337,12 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
 
     /* Copy the data over; this is refcount-neutral for active entries;
        dummy entries aren't copied over, of course */
+    dummy_entry = dummy;
     for (entry = oldtable; i > 0; entry++) {
         if (entry->key == NULL) {
             /* UNUSED */
             ;
-        } else if (entry->key == dummy) {
+        } else if (entry->key == dummy_entry) {
             /* DUMMY */
             --i;
             assert(entry->key == dummy);