1. Python CFFI
  2. Untitled project
  3. cffi
Issue #110 resolved

cffi uses inconsistent suffixes

Donald Stufft
created an issue

So I have my Verifier instance monkeypatched to prevent any runtime compilation at all. I noticed that this was failing with Python3.x. After digging into it more It's because the methods used by the Verifier is inconsistent with the method used by distutils.

Distutils uses distutls.sysconfig.get_config_var("EXT_SUFFIX") which returns ".so", however the Verifier() instance uses cffi.verifier._get_so_suffix() which returns ".cpython-33m.so". Under the hood cffi.verifier._get_so_suffix() uses imp.get_suffixes().

I believe that either cffi should be smart enough to check all of the possible imp.C_EXTENSION suffixes from imp.get_suffixes() or it should use the same means that distutils does to determine what the suffix should be.

distutils code here: https://github.com/python/cpython/blob/ea8fbb22efc32476fca81af70d937d907b677a77/Lib/distutils/command/build_ext.py#L668-L670

Comments (3)

  1. Donald Stufft reporter

    To make this worse, PyPy distutils apparently does generate a so ending with pypy-21.so, which is the opposite behavior to what CPython does on my machine :[

    Luckily that would still be solved by trying to load all the different types of suffixes.

  2. Donald Stufft reporter

    I have no idea what Windows does, but i've investigated this more.

    Linux -> distutils builds using the tagged .so's OSX -> distutils builds using plain .so's

  3. Log in to comment