Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab11c09

Browse filesBrowse files
authored
gh-129666: Revert "gh-129666: Add C11/C++11 to docs and -pedantic-errors to GCC/clang test_c[pp]ext tests (GH-130686)" (GH-130688)
This reverts commit 003e6d2.
1 parent 003e6d2 commit ab11c09
Copy full SHA for ab11c09

File tree

Expand file treeCollapse file tree

7 files changed

+0
-62
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

7 files changed

+0
-62
lines changed
Open diff view settings
Collapse file

‎Doc/c-api/intro.rst‎

Copy file name to clipboardExpand all lines: Doc/c-api/intro.rst
-10Lines changed: 0 additions & 10 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ familiar with writing an extension before attempting to embed Python in a real
3030
application.
3131

3232

33-
Language version compatibility
34-
==============================
35-
36-
Python's C API is compatible with C11 and C++11 versions of C and C++.
37-
38-
This is a lower limit: the C API does not require features from later
39-
C/C++ versions.
40-
You do *not* need to enable your compiler's "c11 mode".
41-
42-
4333
Coding standards
4434
================
4535

Collapse file

‎Lib/test/test_cext/__init__.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_cext/__init__.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ def test_build_c11(self):
3838

3939
@unittest.skipIf(support.MS_WINDOWS, "MSVC doesn't support /std:c99")
4040
def test_build_c99(self):
41-
# In public docs, we say C API is compatible with C11. However,
42-
# in practice we do maintain C99 compatibility in public headers.
43-
# Please ask the C API WG before adding a new C11-only feature.
4441
self.check_build('_test_c99_cext', std='c99')
4542

4643
@support.requires_gil_enabled('incompatible with Free Threading')
Collapse file

‎Lib/test/test_cext/extension.c‎

Copy file name to clipboardExpand all lines: Lib/test/test_cext/extension.c
-13Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,11 @@ _testcext_exec(
5858
return 0;
5959
}
6060

61-
// Converting from function pointer to void* has undefined behavior, but
62-
// works on all known platforms, and CPython's module and type slots currently
63-
// need it.
64-
// (GCC doesn't have a narrower category for this than -Wpedantic.)
65-
_Py_COMP_DIAG_PUSH
66-
#if defined(__GNUC__)
67-
#pragma GCC diagnostic ignored "-Wpedantic"
68-
#elif defined(__clang__)
69-
#pragma clang diagnostic ignored "-Wpedantic"
70-
#endif
71-
7261
static PyModuleDef_Slot _testcext_slots[] = {
7362
{Py_mod_exec, (void*)_testcext_exec},
7463
{0, NULL}
7564
};
7665

77-
_Py_COMP_DIAG_POP
78-
7966

8067
PyDoc_STRVAR(_testcext_doc, "C test extension.");
8168

Collapse file

‎Lib/test/test_cext/setup.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_cext/setup.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121

2222
# gh-120593: Check the 'const' qualifier
2323
'-Wcast-qual',
24-
25-
# Ask for strict(er) compliance with the standard
26-
'-pedantic-errors',
2724
]
2825
if not support.Py_GIL_DISABLED:
2926
CFLAGS.append(
Collapse file

‎Lib/test/test_cppext/__init__.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_cppext/__init__.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ def test_build(self):
2929
self.check_build('_testcppext')
3030

3131
def test_build_cpp03(self):
32-
# In public docs, we say C API is compatible with C++11. However,
33-
# in practice we do maintain C++03 compatibility in public headers.
34-
# Please ask the C API WG before adding a new C++11-only feature.
3532
self.check_build('_testcpp03ext', std='c++03')
3633

3734
@unittest.skipIf(support.MS_WINDOWS, "MSVC doesn't support /std:c++11")
Collapse file

‎Lib/test/test_cppext/extension.cpp‎

Copy file name to clipboardExpand all lines: Lib/test/test_cppext/extension.cpp
-22Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,11 @@ class VirtualPyObject : public PyObject {
161161

162162
int VirtualPyObject::instance_count = 0;
163163

164-
// Converting from function pointer to void* has undefined behavior, but
165-
// works on all known platforms, and CPython's module and type slots currently
166-
// need it.
167-
// (GCC doesn't have a narrower category for this than -Wpedantic.)
168-
_Py_COMP_DIAG_PUSH
169-
#if defined(__GNUC__)
170-
#pragma GCC diagnostic ignored "-Wpedantic"
171-
#elif defined(__clang__)
172-
#pragma clang diagnostic ignored "-Wpedantic"
173-
#endif
174-
175164
PyType_Slot VirtualPyObject_Slots[] = {
176165
{Py_tp_free, (void*)VirtualPyObject::dealloc},
177166
{0, _Py_NULL},
178167
};
179168

180-
_Py_COMP_DIAG_POP
181-
182169
PyType_Spec VirtualPyObject_Spec = {
183170
/* .name */ STR(MODULE_NAME) ".VirtualPyObject",
184171
/* .basicsize */ sizeof(VirtualPyObject),
@@ -254,20 +241,11 @@ _testcppext_exec(PyObject *module)
254241
return 0;
255242
}
256243

257-
// Need to ignore "-Wpedantic" warnings; see VirtualPyObject_Slots above
258-
_Py_COMP_DIAG_PUSH
259-
#if defined(__GNUC__)
260-
#pragma GCC diagnostic ignored "-Wpedantic"
261-
#elif defined(__clang__)
262-
#pragma clang diagnostic ignored "-Wpedantic"
263-
#endif
264-
265244
static PyModuleDef_Slot _testcppext_slots[] = {
266245
{Py_mod_exec, reinterpret_cast<void*>(_testcppext_exec)},
267246
{0, _Py_NULL}
268247
};
269248

270-
_Py_COMP_DIAG_POP
271249

272250
PyDoc_STRVAR(_testcppext_doc, "C++ test extension.");
273251

Collapse file

‎Lib/test/test_cppext/setup.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_cppext/setup.py
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@
1818
# a C++ extension using the Python C API does not emit C++ compiler
1919
# warnings
2020
'-Werror',
21-
22-
# Ask for strict(er) compliance with the standard.
23-
'-pedantic-errors',
24-
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',
2921
]
3022
else:
3123
# MSVC compiler flags

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.