Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid setting Py_LIMITED_API when py_limited_api=False #106

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cffi/setuptools_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def _set_py_limited_api(Extension, kwds):
# try to set 'py_limited_api' anyway. At worst, we get a
# warning.
kwds['py_limited_api'] = True

if kwds.get('py_limited_api') is False:
# avoid setting Py_LIMITED_API if py_limited_api=False
# which _cffi_include.h does unless _CFFI_NO_LIMITED_API is defined
kwds.setdefault("define_macros", []).append(("_CFFI_NO_LIMITED_API", None))
return kwds

def _add_c_module(dist, ffi, module_name, source, source_extension, kwds):
Expand Down
Loading