[Python-checkins] cpython: Hoist the global "dummy" lookup outside of the reinsertion loop.

raymond.hettinger python-checkins at python.org
Thu Aug 15 11:19:15 CEST 2013


http://hg.python.org/cpython/rev/9c019475bb2f
changeset:   85176:9c019475bb2f
user:        Raymond Hettinger <python at rcn.com>
date:        Thu Aug 15 02:18:55 2013 -0700
summary:
  Hoist the global "dummy" lookup outside of the reinsertion loop.

files:
  Objects/setobject.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -280,6 +280,7 @@
     Py_ssize_t i;
     int is_oldtable_malloced;
     setentry small_copy[PySet_MINSIZE];
+    PyObject *dummy_entry;
 
     assert(minused >= 0);
 
@@ -336,11 +337,12 @@
 
     /* 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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list