Skip to content

Commit dd835ff

Browse files
committed
Only use /W4 on Python 3.12 and newer
1 parent 0f1da5d commit dd835ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@
4141
else:
4242
# C compiler flags for MSVC
4343
COMMON_FLAGS.extend((
44-
# Display warnings level 1 to 4
45-
'/W4',
4644
# Treat all compiler warnings as compiler errors
4745
'/WX',
4846
))
47+
# Python 3.11 and older emits C4100 "unreferenced parameter" warnings
48+
# on Py_UNUSED() parameters. Py_UNUSED() was modified in Python 3.12
49+
# to support MSVC.
50+
if sys.version_info >= (3, 12):
51+
COMMON_FLAGS.extend((
52+
# Display warnings level 1 to 4
53+
'/W4',
54+
))
4955
CFLAGS = list(COMMON_FLAGS)
5056
CXXFLAGS = list(COMMON_FLAGS)
5157

0 commit comments

Comments
 (0)