Skip to content

Commit 4435cec

Browse files
authored
Merge pull request #205 from fweimer-rh/ccompiler-include
distutils.ccompiler.CCompiler.has_function: Quote #include argument
2 parents 8c3c3d2 + b022b25 commit 4435cec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

distutils/ccompiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ def has_function( # noqa: C901
860860
f = os.fdopen(fd, "w")
861861
try:
862862
for incl in includes:
863-
f.write("""#include %s\n""" % incl)
863+
f.write("""#include "%s"\n""" % incl)
864864
if not includes:
865865
# Use "char func(void);" as the prototype to follow
866866
# what autoconf does. This prototype does not match

distutils/tests/test_ccompiler.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ def test_has_function_prototype():
6666
assert compiler.has_function('exit')
6767
with pytest.deprecated_call(match='includes is deprecated'):
6868
# abort() is a valid expression with the <stdlib.h> prototype.
69-
assert compiler.has_function('abort', includes=['<stdlib.h>'])
69+
assert compiler.has_function('abort', includes=['stdlib.h'])
7070
with pytest.deprecated_call(match='includes is deprecated'):
7171
# But exit() is not valid with the actual prototype in scope.
72-
assert not compiler.has_function('exit', includes=['<stdlib.h>'])
72+
assert not compiler.has_function('exit', includes=['stdlib.h'])
7373
# And setuptools_does_not_exist is not declared or defined at all.
7474
assert not compiler.has_function('setuptools_does_not_exist')
7575
with pytest.deprecated_call(match='includes is deprecated'):
7676
assert not compiler.has_function(
77-
'setuptools_does_not_exist', includes=['<stdio.h>']
77+
'setuptools_does_not_exist', includes=['stdio.h']
7878
)
7979

8080

0 commit comments

Comments
 (0)