Commits

Armin Rigo  committed b5119bf

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

  • Participants
  • Parent commits 121f1e7

Comments (0)

Files changed (1)

File cffi/verifier.py

                 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