File tree 3 files changed +17
-5
lines changed
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -683,7 +683,7 @@ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
683
683
typedef enum {
684
684
PYGEN_RETURN = 0 ,
685
685
PYGEN_ERROR = -1 ,
686
- PYGEN_NEXT = 1 ,
686
+ PYGEN_NEXT = 1
687
687
} PySendResult ;
688
688
#endif
689
689
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ def test_build_cpp03(self):
34
34
# Please ask the C API WG before adding a new C++11-only feature.
35
35
self .check_build ('_testcpp03ext' , std = 'c++03' )
36
36
37
+ @support .requires_gil_enabled ('incompatible with Free Threading' )
38
+ def test_build_limited_cpp03 (self ):
39
+ self .check_build ('_test_limited_cpp03ext' , std = 'c++03' , limited = True )
40
+
37
41
@unittest .skipIf (support .MS_WINDOWS , "MSVC doesn't support /std:c++11" )
38
42
def test_build_cpp11 (self ):
39
43
self .check_build ('_testcpp11ext' , std = 'c++11' )
Original file line number Diff line number Diff line change 18
18
# a C++ extension using the Python C API does not emit C++ compiler
19
19
# warnings
20
20
'-Werror' ,
21
+ ]
21
22
23
+ CPPFLAGS_PEDANTIC = [
22
24
# Ask for strict(er) compliance with the standard.
25
+ # We cannot do this for c++03 unlimited API, since several headers in
26
+ # Include/cpython/ use commas at end of `enum` declarations, a C++11
27
+ # feature for which GCC has no narrower option than -Wpedantic itself.
23
28
'-pedantic-errors' ,
24
29
25
- # But allow C++11 features for -std=C++03. We use:
26
- # - `long long` (-Wno-c++11-long-long)
27
- # - comma at end of `enum` lists (no narrower GCC option exists)
28
- '-Wno-c++11-extensions' ,
30
+ # We also use `long long`, a C++11 feature we can enable individually.
31
+ '-Wno-long-long' ,
29
32
]
30
33
else :
31
34
# MSVC compiler flags
35
38
# Treat all compiler warnings as compiler errors
36
39
'/WX' ,
37
40
]
41
+ CPPFLAGS_PEDANTIC = []
38
42
39
43
40
44
def main ():
@@ -53,6 +57,10 @@ def main():
53
57
else :
54
58
cppflags .append (f'-std={ std } ' )
55
59
60
+ if limited or (std != 'c++03' ):
61
+ # See CPPFLAGS_PEDANTIC docstring
62
+ cppflags .extend (CPPFLAGS_PEDANTIC )
63
+
56
64
# gh-105776: When "gcc -std=11" is used as the C++ compiler, -std=c11
57
65
# option emits a C++ compiler warning. Remove "-std11" option from the
58
66
# CC command.
You can’t perform that action at this time.
0 commit comments