[pypy-svn] r78309 - pypy/trunk/pypy/objspace/std

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Oct 26 18:13:35 CEST 2010


Author: cfbolz
Date: Tue Oct 26 18:13:33 2010
New Revision: 78309

Modified:
   pypy/trunk/pypy/objspace/std/typeobject.py
Log:
(arigo, cfbolz): essential optimization: don't intern the slot name if the slot
will be discarded.


Modified: pypy/trunk/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/typeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/typeobject.py	Tue Oct 26 18:13:33 2010
@@ -557,9 +557,9 @@
                              space.wrap('__slots__ must be identifiers'))
     # create member
     slot_name = _mangle(slot_name, w_self.name)
-    # Force interning of slot names.
-    slot_name = space.str_w(space.new_interned_str(slot_name))
     if slot_name not in w_self.dict_w:
+        # Force interning of slot names.
+        slot_name = space.str_w(space.new_interned_str(slot_name))
         # in cpython it is ignored less, but we probably don't care
         member = Member(w_self.nslots, slot_name, w_self)
         w_self.dict_w[slot_name] = space.wrap(member)



More information about the Pypy-commit mailing list