aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2016-09-04 17:55:23 +0300
committerMatti Picus <matti.picus@gmail.com>2016-09-04 17:55:23 +0300
commitb86e4259190207c9db421387b0588b1565f8813f (patch)
treefdca16302af2d617ffd5611609e634a9ebc98bfb
parentimport cffi/b81ca61b6de6 (diff)
downloadpypy-b86e4259190207c9db421387b0588b1565f8813f.tar.gz
pypy-b86e4259190207c9db421387b0588b1565f8813f.tar.bz2
pypy-b86e4259190207c9db421387b0588b1565f8813f.zip
import cffi/cb6147abe7af
(grafted from c224171fc33e53442553735d23896c4cd2d51b34)
-rw-r--r--lib_pypy/cffi/backend_ctypes.py6
-rw-r--r--pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/lib_pypy/cffi/backend_ctypes.py b/lib_pypy/cffi/backend_ctypes.py
index d160fa7e6e..1002facf21 100644
--- a/lib_pypy/cffi/backend_ctypes.py
+++ b/lib_pypy/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
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py
index 0a91652487..d183ab5f04 100644
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py
@@ -154,7 +154,10 @@ class TestZIntegration(object):
from cffi.setuptools_ext import _set_py_limited_api
try:
import setuptools
- orig_version = setuptools.__version__
+ except ImportError as e:
+ py.test.skip(str(e))
+ orig_version = setuptools.__version__
+ try:
setuptools.__version__ = '26.0.0'
from setuptools import Extension