summaryrefslogtreecommitdiff
path: root/cffi/verifier.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-09-25 10:24:53 +0200
committerArmin Rigo <arigo@tunes.org>2012-09-25 10:24:53 +0200
commitdda7ccaef2006e7cb2424b65403b6f2e3df40083 (patch)
tree00c27000beeae9028d81d816fb6e195d85e67803 /cffi/verifier.py
parent46ceaeb504f1215611f9b3939ac02503f4be20c8 (diff)
downloadcffi-dda7ccaef2006e7cb2424b65403b6f2e3df40083.tar.gz
Fix for PyPy: load the '.pypy-19.so' file even though find_module()
tends to return the dummy '.py' file created by setuptools.
Diffstat (limited to 'cffi/verifier.py')
-rw-r--r--cffi/verifier.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cffi/verifier.py b/cffi/verifier.py
index d2b051a..c303ecd 100644
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -97,6 +97,14 @@ class Verifier(object):
return
if f is not None:
f.close()
+ if filename.lower().endswith('.py'):
+ # on PyPy, if there are both .py and .pypy-19.so files in
+ # the same directory, the .py file is returned. That's the
+ # case after a setuptools installation. We never want to
+ # load the .py file here...
+ filename = filename[:-3] + _get_so_suffix()
+ if not os.path.isfile(filename):
+ return
self.modulefilename = filename
self._vengine.collect_types()
self._has_module = True