diff options
author | Armin Rigo <arigo@tunes.org> | 2016-09-03 20:10:48 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2016-09-03 20:10:48 +0200 |
commit | cdede2fb38671c5b1d5d34871db411749a9efcd2 (patch) | |
tree | 71427fd163768e50f76167931733c233d703ac18 | |
parent | d114114c36d8ffdb73321b810c8732fefdf80604 (diff) | |
download | cffi-cdede2fb38671c5b1d5d34871db411749a9efcd2.tar.gz |
fix
-rw-r--r-- | cffi/backend_ctypes.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py index ed2e6cd..d160fa7 100644 --- a/cffi/backend_ctypes.py +++ b/cffi/backend_ctypes.py @@ -1004,9 +1004,11 @@ class CTypesBackend(object): 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 |