1. Python CFFI
  2. Untitled project
  3. cffi


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
  • Branches default

Comments (0)

Files changed (1)

File cffi/verifier.py

View file
             if f is not None:
+            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._has_module = True