Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r970:b5119bf013f8
Date: 2012-09-25 10:24 +0200
http://bitbucket.org/cffi/cffi/changeset/b5119bf013f8/

Log:    Fix for PyPy: load the '.pypy-19.so' file even though find_module()
        tends to return the dummy '.py' file created by setuptools.

diff --git a/cffi/verifier.py b/cffi/verifier.py
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -97,6 +97,14 @@
                 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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to