We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f40611 commit efe1ac1Copy full SHA for efe1ac1
setup.py
@@ -17,11 +17,8 @@ def has_flag(compiler, flagname):
17
"""
18
import tempfile
19
fd, fname = tempfile.mkstemp('.cpp', 'main', text=True)
20
- f = os.fdopen(fd, 'w')
21
- try:
+ with os.fdopen(fd, 'w') as f:
22
f.write('int main (int argc, char **argv) { return 0; }')
23
- finally:
24
- f.close()
25
try:
26
compiler.compile([fname], extra_postargs=[flagname])
27
except setuptools.distutils.errors.CompileError:
0 commit comments