Armin Rigo  committed b5119bf

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

  • Participants
  • Parent commits 121f1e7
  • Branches default

Comments (0)

Files changed (1)

File cffi/

             if f is not None:
+            if filename.lower().endswith('.py'):
+                # on PyPy, if there are both .py and 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._has_module = True