Skip to content

Commit 16b143d

Browse files
authored
avoid setting Py_LIMITED_API when py_limited_api=False (#106)
* avoid setting Py_LIMITED_API when py_limited_api=False previously, setting py_limited_api=False only appeared to affect the ABI tag of modules, as Py_LIMITED_API was still unconditionally defined in most cases by _cffi_include.h * only unset limited api for explicit py_limited_api=False
1 parent fb6e5dc commit 16b143d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cffi/setuptools_ext.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ def _set_py_limited_api(Extension, kwds):
101101
# try to set 'py_limited_api' anyway. At worst, we get a
102102
# warning.
103103
kwds['py_limited_api'] = True
104+
105+
if kwds.get('py_limited_api') is False:
106+
# avoid setting Py_LIMITED_API if py_limited_api=False
107+
# which _cffi_include.h does unless _CFFI_NO_LIMITED_API is defined
108+
kwds.setdefault("define_macros", []).append(("_CFFI_NO_LIMITED_API", None))
104109
return kwds
105110

106111
def _add_c_module(dist, ffi, module_name, source, source_extension, kwds):

0 commit comments

Comments
 (0)