File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change
1
+ Fixed a bug where calling ``build_ext.finalize_options `` more than once would
2
+ raise an exception.
Original file line number Diff line number Diff line change @@ -276,10 +276,10 @@ def finalize_options(self) -> None: # noqa: C901
276
276
if self .undef :
277
277
self .undef = self .undef .split (',' )
278
278
279
- if self .swig_opts is None :
280
- self .swig_opts = []
281
- else :
279
+ if isinstance (self .swig_opts , str ):
282
280
self .swig_opts = self .swig_opts .split (' ' )
281
+ elif self .swig_opts is None :
282
+ self .swig_opts = []
283
283
284
284
# Finally add the user include and library directories if requested
285
285
if self .user :
Original file line number Diff line number Diff line change @@ -178,6 +178,17 @@ def C(file):
178
178
assert example_stub .startswith (f"{ build_lib } /mypkg/__pycache__/ext1" )
179
179
assert example_stub .endswith (".pyc" )
180
180
181
+ def test_finalize_options_multiple_call (self ):
182
+ """
183
+ Regression test. Check that calling build_ext.finalize_options
184
+ more than once doesn't raise an exception.
185
+ """
186
+ extension = Extension ('spam.eggs' , ['eggs.c' ])
187
+ dist = Distribution (dict (ext_modules = [extension ]))
188
+ cmd = build_ext (dist )
189
+ cmd .finalize_options ()
190
+ cmd .finalize_options ()
191
+
181
192
182
193
class TestBuildExtInplace :
183
194
def get_build_ext_cmd (self , optional : bool , ** opts ) -> build_ext :
You can’t perform that action at this time.
0 commit comments