Skip to content

Please make the C extension build optional (e.g. via PURE_PYTHON) #330

@mgorny

Description

@mgorny

FEATURE REQUEST

Could you consider making the C extension build in setup.py optional, similarly to how the extensions are currently optional in tests? (i.e. if PURE_PYTHON=1, it wouldn't attempt to build them at all)

Our primary use case right now is Python 3.13 freethreading. Since the speedups extension does not support freethreading, importing it effectively reenables GIL for the whole program:

>>> import zope.interface
<frozen importlib._bootstrap>:488: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'zope.interface._zope_interface_coptimizations', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.

For the time being, we believe that the "lesser evil" would be to install install zope.interface without speedups, and keep GIL disabled for the remainder of the program. The way we see it, it would be done like:

$ PURE_PYTHON=1 pip install zope.interface

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions