[pypy-commit] cffi default: Don't need an integer, actually, just object() is fine

arigo noreply at buildbot.pypy.org
Tue Jun 9 13:53:05 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2180:325525b02433
Date: 2015-06-09 13:53 +0200
http://bitbucket.org/cffi/cffi/changeset/325525b02433/

Log:	Don't need an integer, actually, just object() is fine

diff --git a/cffi/gc_weakref.py b/cffi/gc_weakref.py
--- a/cffi/gc_weakref.py
+++ b/cffi/gc_weakref.py
@@ -5,7 +5,6 @@
     def __init__(self, ffi):
         self.ffi = ffi
         self.data = {}
-        self.nextindex = 0
 
     def build(self, cdata, destructor):
         # make a new cdata of the same type as the original one
@@ -18,7 +17,6 @@
             destructor(cdata)
         #
         key = ref(new_cdata, remove)
-        index = self.nextindex
-        self.nextindex = index + 1     # we're protected by the lock here
+        index = object()
         self.data[index] = key
         return new_cdata


More information about the pypy-commit mailing list