Skip to content

Commit 9929956

Browse files
ngoldbaummattip
authored andcommitted
Delete historical USE_LIMITED_API helper
1 parent 25b352e commit 9929956

4 files changed

Lines changed: 0 additions & 28 deletions

File tree

‎src/cffi/_cffi_include.h‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
In that case, we guess what pyconfig.h will do to the macros above,
1414
and check our guess after the #include.
1515
16-
Note that on Windows, with CPython 3.x, you need >= 3.5 and virtualenv
17-
version >= 16.0.0. With older versions of either, you don't get a
18-
copy of PYTHON3.DLL in the virtualenv. We can't check the version of
19-
CPython *before* we even include pyconfig.h. ffi.set_source() puts
20-
a ``#define _CFFI_NO_LIMITED_API'' at the start of this file if it is
21-
running on Windows < 3.5, as an attempt at fixing it, but that's
22-
arguably wrong because it may not be the target version of Python.
23-
Still better than nothing I guess. As another workaround, you can
24-
remove the definition of Py_LIMITED_API here.
25-
2616
See also 'py_limited_api' in cffi/setuptools_ext.py.
2717
*/
2818
#if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API)

‎src/cffi/recompiler.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
VERSION_EMBEDDED = 0x2701
88
VERSION_CHAR16CHAR32 = 0x2801
99

10-
# Must not depend on the interpreter running the generator: the generated
11-
# source may be compiled for a different one (see cffi-gen-src). Decisions
12-
# about the target, such as abi3t support, are made at compile time in
13-
# _cffi_include.h.
14-
USE_LIMITED_API = (sys.platform != 'win32' or sys.version_info < (3, 0) or
15-
sys.version_info >= (3, 5))
1610

1711
class GlobalExpr:
1812
def __init__(self, name, address, type_op, size=0, check_value=0):
@@ -307,8 +301,6 @@ def write_c_source_to_f(self, f, preamble):
307301
prnt = self._prnt
308302
if self.ffi._embedding is not None:
309303
prnt('#define _CFFI_USE_EMBEDDING')
310-
if not USE_LIMITED_API:
311-
prnt('#define _CFFI_NO_LIMITED_API')
312304
#
313305
# first the '#include' (actually done by inlining the file's content)
314306
lines = self._rel_readlines('_cffi_include.h')

‎src/cffi/setuptools_ext.py‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,10 @@ def _set_py_limited_api(Extension, kwds):
8282
it doesn't so far, creating troubles. That's why we check
8383
for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent
8484
of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401)
85-
86-
On Windows, with CPython <= 3.4, it's better not to use py_limited_api
87-
because virtualenv *still* doesn't copy PYTHON3.DLL on these versions.
88-
Recently (2020) we started shipping only >= 3.5 wheels, though. So
89-
we'll give it another try and set py_limited_api on Windows >= 3.5.
9085
"""
9186
from cffi._shimmed_dist_utils import log
92-
from cffi import recompiler
9387

9488
if ('py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount')
95-
and recompiler.USE_LIMITED_API
96-
# unlike USE_LIMITED_API, checking the running interpreter is
97-
# correct here: setuptools generates and compiles in one process
9889
and (not sysconfig.get_config_var("Py_GIL_DISABLED")
9990
or sys.version_info >= (3, 15))):
10091
import setuptools

‎testing/cffi1/test_recompiler.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,6 @@ def test_emit_c_code_is_interpreter_independent():
26002600
# the emitted source must be a pure function of the FFI object, with
26012601
# no #defines derived from the interpreter running the generator
26022602
import io
2603-
assert recompiler.USE_LIMITED_API # constant on all supported Pythons
26042603
ffi = FFI()
26052604
ffi.cdef("int ff_interp_indep(int);")
26062605
ffi.set_source("_CFFI_interp_indep",

0 commit comments

Comments
 (0)