summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-09-03 23:42:59 +0200
committerArmin Rigo <arigo@tunes.org>2016-09-03 23:42:59 +0200
commit09973eefe01cd6000365a47a81f6818b867ea357 (patch)
treea8585adfcee6d603b1e43289ead135caf9792e9e
parentcdede2fb38671c5b1d5d34871db411749a9efcd2 (diff)
downloadcffi-09973eefe01cd6000365a47a81f6818b867ea357.tar.gz
Python 3 fix
-rw-r--r--cffi/backend_ctypes.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py
index d160fa7..1002fac 100644
--- a/cffi/backend_ctypes.py
+++ b/cffi/backend_ctypes.py
@@ -1009,6 +1009,12 @@ class CTypesBackend(object):
myref is not None and myref is other())
def __ne__(self, other):
return not (self == other)
+ def __hash__(self):
+ try:
+ return self._hash
+ except AttributeError:
+ self._hash = hash(self())
+ return self._hash
self._weakref_cache_ref = {}, MyRef
weak_cache, MyRef = self._weakref_cache_ref