File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 11# gh-91321: Build a basic C++ test extension to check that the Python C API is
22# compatible with C++ and does not emit C++ compiler warnings.
33import os
4+ import shlex
45import sys
6+ import sysconfig
57
68from setuptools import setup , Extension
79
@@ -30,6 +32,17 @@ def main():
3032
3133 cppflags = [* CPPFLAGS , f'-std={ std } ' ]
3234
35+ # gh-105776: When "gcc -std=11" is used as the C++ compiler, -std=c11
36+ # option emits a C++ compiler warning. Remove "-std11" option from the
37+ # CC command.
38+ cmd = (sysconfig .get_config_var ('CC' ) or '' )
39+ if cmd is not None :
40+ cmd = shlex .split (cmd )
41+ cmd = [arg for arg in cmd if not arg .startswith ('-std=' )]
42+ cmd = shlex .join (cmd )
43+ # CC env var overrides sysconfig CC variable in setuptools
44+ os .environ ['CC' ] = cmd
45+
3346 cpp_ext = Extension (
3447 name ,
3548 sources = [SOURCE ],
Original file line number Diff line number Diff line change 1+ Fix test_cppext when the C compiler command ``-std=c11 `` option: remove
2+ ``-std= `` options from the compiler command. Patch by Victor Stinner.
You can’t perform that action at this time.
0 commit comments