File tree 2 files changed +15
-1
lines changed 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,15 @@ def build_extension(self, ext):
285
285
286
286
ext .install_script (ext_path )
287
287
else :
288
- ext_path = build_ext .get_ext_fullpath (target_fname )
288
+ # Technically it's supposed to contain a
289
+ # `setuptools.Extension`, but in practice the only attribute it
290
+ # checks is `ext.py_limited_api`.
291
+ assert ext .name not in build_ext .ext_map
292
+ build_ext .ext_map [ext .name ] = ext
293
+ try :
294
+ ext_path = build_ext .get_ext_fullpath (target_fname )
295
+ finally :
296
+ del build_ext .ext_map [ext .name ]
289
297
290
298
try :
291
299
os .makedirs (os .path .dirname (ext_path ))
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ class RustExtension:
47
47
optional : bool
48
48
if it is true, a build failure in the extension will not abort the
49
49
build process, but instead simply not install the failing extension.
50
+ py_limited_api : bool
51
+ Same as `py_limited_api` on `setuptools.Extension`. Note that if you
52
+ set this to True, your extension must pass the appropriate feature
53
+ flags to pyo3 (ensuring that `abi3` feature is enabled).
50
54
"""
51
55
52
56
def __init__ (
@@ -64,6 +68,7 @@ def __init__(
64
68
script = False ,
65
69
native = False ,
66
70
optional = False ,
71
+ py_limited_api = False ,
67
72
):
68
73
if isinstance (target , dict ):
69
74
name = "; " .join ("%s=%s" % (key , val ) for key , val in target .items ())
@@ -83,6 +88,7 @@ def __init__(
83
88
self .script = script
84
89
self .native = native
85
90
self .optional = optional
91
+ self .py_limited_api = py_limited_api
86
92
87
93
if features is None :
88
94
features = []
You can’t perform that action at this time.
0 commit comments