Skip to content

Commit

Permalink
Merge pull request #3835 from pypa/distutils-4435cec3
Browse files Browse the repository at this point in the history
Merge with distutils@4435cec3
  • Loading branch information
jaraco authored Feb 20, 2023
2 parents abd6dbb + dd5ae79 commit 10ff25c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/3820.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore quoted ``#include`` argument to ``has_function``.
2 changes: 1 addition & 1 deletion setuptools/_distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def has_function( # noqa: C901
f = os.fdopen(fd, "w")
try:
for incl in includes:
f.write("""#include %s\n""" % incl)
f.write("""#include "%s"\n""" % incl)
if not includes:
# Use "char func(void);" as the prototype to follow
# what autoconf does. This prototype does not match
Expand Down
6 changes: 3 additions & 3 deletions setuptools/_distutils/tests/test_ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ def test_has_function_prototype():
assert compiler.has_function('exit')
with pytest.deprecated_call(match='includes is deprecated'):
# abort() is a valid expression with the <stdlib.h> prototype.
assert compiler.has_function('abort', includes=['<stdlib.h>'])
assert compiler.has_function('abort', includes=['stdlib.h'])
with pytest.deprecated_call(match='includes is deprecated'):
# But exit() is not valid with the actual prototype in scope.
assert not compiler.has_function('exit', includes=['<stdlib.h>'])
assert not compiler.has_function('exit', includes=['stdlib.h'])
# And setuptools_does_not_exist is not declared or defined at all.
assert not compiler.has_function('setuptools_does_not_exist')
with pytest.deprecated_call(match='includes is deprecated'):
assert not compiler.has_function(
'setuptools_does_not_exist', includes=['<stdio.h>']
'setuptools_does_not_exist', includes=['stdio.h']
)


Expand Down

0 comments on commit 10ff25c

Please sign in to comment.