Skip to content

Commit

Permalink
distutils.ccompiler: Remove correct executable file on Windows
Browse files Browse the repository at this point in the history
The previous code did not take into account the .exe file extension
on Windows.
  • Loading branch information
fweimer-rh committed Feb 6, 2023
1 parent 2f16327 commit 7e751d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,9 @@ def has_function( # noqa: C901
except (LinkError, TypeError):
return False
else:
os.remove(os.path.join(self.output_dir or '', "a.out"))
os.remove(
self.executable_filename("a.out", output_dir=self.output_dir or '')
)
finally:
for fn in objects:
os.remove(fn)
Expand Down
1 change: 0 additions & 1 deletion distutils/tests/test_ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def test_set_include_dirs(c_file):
compiler.compile(_make_strs([c_file]))


@pytest.mark.xfail('platform.system() == "Windows"')
def test_has_function_prototype():
# Issue https://github.com/pypa/setuptools/issues/3648
# Test prototype-generating behavior.
Expand Down

0 comments on commit 7e751d3

Please sign in to comment.