File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -276,10 +276,10 @@ def finalize_options(self) -> None: # noqa: C901
276276 if self .undef :
277277 self .undef = self .undef .split (',' )
278278
279- if self .swig_opts is None :
280- self .swig_opts = []
281- else :
279+ if isinstance (self .swig_opts , str ):
282280 self .swig_opts = self .swig_opts .split (' ' )
281+ elif self .swig_opts is None :
282+ self .swig_opts = []
283283
284284 # Finally add the user include and library directories if requested
285285 if self .user :
Original file line number Diff line number Diff line change @@ -320,6 +320,12 @@ def test_finalize_options(self):
320320 cmd .finalize_options ()
321321 assert cmd .swig_opts == ['1' , '2' ]
322322
323+ # make sure finalize_options() can be called more than once
324+ # without raising an exception
325+ cmd = self .build_ext (dist )
326+ cmd .finalize_options ()
327+ cmd .finalize_options ()
328+
323329 def test_check_extensions_list (self ):
324330 dist = Distribution ()
325331 cmd = self .build_ext (dist )
Original file line number Diff line number Diff line change 1+ Fix a bug where calling ``distutils.build_ext.finalize_options `` more than once
2+ would raise an exception.
You can’t perform that action at this time.
0 commit comments