[pypy-commit] cffi default: fix

arigo pypy.commits at gmail.com
Sat Sep 3 14:10:55 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2758:b81ca61b6de6
Date: 2016-09-03 20:10 +0200
http://bitbucket.org/cffi/cffi/changeset/b81ca61b6de6/

Log:	fix

diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py
--- a/cffi/backend_ctypes.py
+++ b/cffi/backend_ctypes.py
@@ -1004,9 +1004,11 @@
             import weakref
             class MyRef(weakref.ref):
                 def __eq__(self, other):
-                    return self() is other()
+                    myref = self()
+                    return self is other or (
+                        myref is not None and myref is other())
                 def __ne__(self, other):
-                    return self() is not other()
+                    return not (self == other)
             self._weakref_cache_ref = {}, MyRef
         weak_cache, MyRef = self._weakref_cache_ref
 


More information about the pypy-commit mailing list