Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit2996a2b

Browse files
authored
[3.13]gh-127906: Backport test_cext changes from the main branch (#127923)
1 parent78095c9 commit2996a2b

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

‎Lib/test/test_cext/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def run_cmd(operation, cmd):
8686
cmd= [python_exe,'-X','dev',
8787
'-m','pip','install','--no-build-isolation',
8888
os.path.abspath(pkg_dir)]
89+
ifsupport.verbose:
90+
cmd.append('-v')
8991
run_cmd('Install',cmd)
9092

9193
# Do a reference run. Until we test that running python

‎Lib/test/test_cext/extension.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ static PyMethodDef _testcext_methods[] = {
3737

3838

3939
staticint
40-
_testcext_exec(PyObject*module)
40+
_testcext_exec(
41+
#ifdef__STDC_VERSION__
42+
PyObject*module
43+
#else
44+
PyObject*Py_UNUSED(module)
45+
#endif
46+
)
4147
{
4248
#ifdef__STDC_VERSION__
4349
if (PyModule_AddIntMacro(module,__STDC_VERSION__)<0) {
@@ -53,7 +59,7 @@ _testcext_exec(PyObject *module)
5359
}
5460

5561
staticPyModuleDef_Slot_testcext_slots[]= {
56-
{Py_mod_exec,_testcext_exec},
62+
{Py_mod_exec,(void*)_testcext_exec},
5763
{0,NULL}
5864
};
5965

‎Lib/test/test_cext/setup.py‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111

1212

1313
SOURCE='extension.c'
14+
1415
ifnotsupport.MS_WINDOWS:
1516
# C compiler flags for GCC and clang
1617
CFLAGS= [
1718
# The purpose of test_cext extension is to check that building a C
1819
# extension using the Python C API does not emit C compiler warnings.
1920
'-Werror',
21+
22+
# gh-120593: Check the 'const' qualifier
23+
'-Wcast-qual',
2024
]
2125
ifnotsupport.Py_GIL_DISABLED:
2226
CFLAGS.append(
@@ -25,8 +29,13 @@
2529
'-Werror=declaration-after-statement',
2630
)
2731
else:
28-
# Don't pass any compiler flag to MSVC
29-
CFLAGS= []
32+
# MSVC compiler flags
33+
CFLAGS= [
34+
# Display warnings level 1 to 4
35+
'/W4',
36+
# Treat all compiler warnings as compiler errors
37+
'/WX',
38+
]
3039

3140

3241
defmain():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp