[pypy-commit] pypy default: When inserting an item in the memodict (so it starts counting at 1) insert the id of None, rather than None itself, this way it stays an int-specialized dict.

alex_gaynor noreply at buildbot.pypy.org
Sun Jul 10 01:43:55 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r45444:4127e61bd4bc
Date: 2011-07-09 16:38 -0700
http://bitbucket.org/pypy/pypy/changeset/4127e61bd4bc/

Log:	When inserting an item in the memodict (so it starts counting at 1)
	insert the id of None, rather than None itself, this way it stays an
	int-specialized dict.

diff --git a/lib_pypy/cPickle.py b/lib_pypy/cPickle.py
--- a/lib_pypy/cPickle.py
+++ b/lib_pypy/cPickle.py
@@ -27,9 +27,9 @@
             PythonPickler.__init__(self, self.__f, args[0], **kw)
         else:
             PythonPickler.__init__(self, *args, **kw)
-            
+
     def memoize(self, obj):
-        self.memo[None] = None   # cPickle starts counting at one
+        self.memo[id(None)] = None   # cPickle starts counting at one
         return PythonPickler.memoize(self, obj)
 
     def getvalue(self):


More information about the pypy-commit mailing list