[pypy-commit] cffi default: Python 3 fix

arigo pypy.commits at gmail.com
Sat Sep 3 17:43:08 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2759:d04043b6e7bc
Date: 2016-09-03 23:42 +0200
http://bitbucket.org/cffi/cffi/changeset/d04043b6e7bc/

Log:	Python 3 fix

diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py
--- a/cffi/backend_ctypes.py
+++ b/cffi/backend_ctypes.py
@@ -1009,6 +1009,12 @@
                         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
 


More information about the pypy-commit mailing list