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

Build C and C++ extensions with /W4 on Windows#168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 4 commits intopython:mainfromvstinner:win_warnings
Feb 12, 2026
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletionspythoncapi_compat.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1569,6 +1569,11 @@ static inline int PyLong_IsZero(PyObject *obj)

// gh-124502 added PyUnicode_Equal() to Python 3.14.0a0
#if PY_VERSION_HEX < 0x030E00A0

#if PY_VERSION_HEX >= 0x030d0000 && !defined(PYPY_VERSION)
PyAPI_FUNC(int)_PyUnicode_Equal(PyObject *str1, PyObject *str2);
#endif

staticinlineintPyUnicode_Equal(PyObject *str1, PyObject *str2)
{
if (!PyUnicode_Check(str1)) {
Expand All@@ -1583,8 +1588,6 @@ static inline int PyUnicode_Equal(PyObject *str1, PyObject *str2)
}

#if PY_VERSION_HEX >= 0x030d0000 && !defined(PYPY_VERSION)
PyAPI_FUNC(int)_PyUnicode_Equal(PyObject *str1, PyObject *str2);

return_PyUnicode_Equal(str1, str2);
#elif PY_VERSION_HEX >= 0x03060000 && !defined(PYPY_VERSION)
return_PyUnicode_EQ(str1, str2);
Expand All@@ -1607,11 +1610,14 @@ static inline PyObject* PyBytes_Join(PyObject *sep, PyObject *iterable)


#if PY_VERSION_HEX < 0x030E00A0

#if PY_VERSION_HEX >= 0x03000000 && !defined(PYPY_VERSION)
PyAPI_FUNC(Py_hash_t)_Py_HashBytes(constvoid *src, Py_ssize_t len);
#endif

staticinline Py_hash_tPy_HashBuffer(constvoid *ptr, Py_ssize_t len)
{
#if PY_VERSION_HEX >= 0x03000000 && !defined(PYPY_VERSION)
PyAPI_FUNC(Py_hash_t)_Py_HashBytes(constvoid *src, Py_ssize_t len);

return_Py_HashBytes(ptr, len);
#else
Py_hash_t hash;
Expand DownExpand Up@@ -1948,11 +1954,14 @@ PyLongWriter_Finish(PyLongWriter *writer)

// gh-127350 added Py_fopen() and Py_fclose() to Python 3.14a4
#if PY_VERSION_HEX < 0x030E00A4

#if 0x030400A2 <= PY_VERSION_HEX && !defined(PYPY_VERSION)
PyAPI_FUNC(FILE*)_Py_fopen_obj(PyObject *path,constchar *mode);
#endif

staticinline FILE*Py_fopen(PyObject *path,constchar *mode)
{
#if 0x030400A2 <= PY_VERSION_HEX && !defined(PYPY_VERSION)
PyAPI_FUNC(FILE*)_Py_fopen_obj(PyObject *path,constchar *mode);

return_Py_fopen_obj(path, mode);
#else
FILE *f;
Expand DownExpand Up@@ -2664,6 +2673,10 @@ PyUnstable_Unicode_GET_CACHED_HASH(PyObject *op)
// to make objects immortal until 3.14 which has _Py_SetImmortal(). Since
// immortal objects are primarily needed for free-threading, this API is implemented
// for 3.14 using _Py_SetImmortal() and uses private macros on 3.13.
#if 0x030E0000 <= PY_VERSION_HEX
PyAPI_FUNC(void)_Py_SetImmortal(PyObject *op);
#endif

staticinlineint
PyUnstable_SetImmortal(PyObject *op)
{
Expand All@@ -2672,7 +2685,6 @@ PyUnstable_SetImmortal(PyObject *op)
return0;
}
#if 0x030E0000 <= PY_VERSION_HEX
PyAPI_FUNC(void)_Py_SetImmortal(PyObject *op);
_Py_SetImmortal(op);
#else
// Python 3.13 doesn't export _Py_SetImmortal() function
Expand Down
11 changes: 8 additions & 3 deletionstests/setup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,9 +32,6 @@
'-Wall', '-Wextra',
# Extra warnings
'-Wconversion',
# /usr/lib64/pypy3.7/include/pyport.h:68:20: error: redefinition of typedef
# 'Py_hash_t' is a C11 feature
'-Wno-typedef-redefinition',
# Formatting checks
'-Wformat',
'-Wformat-nonliteral',
Expand All@@ -47,6 +44,14 @@
# Treat all compiler warnings as compiler errors
'/WX',
))
# Python 3.11 and older emits C4100 "unreferenced parameter" warnings
# on Py_UNUSED() parameters. Py_UNUSED() was modified in Python 3.12
# to support MSVC.
if sys.version_info >= (3, 12):
COMMON_FLAGS.extend((
# Display warnings level 1 to 4
'/W4',
))
CFLAGS = list(COMMON_FLAGS)
CXXFLAGS = list(COMMON_FLAGS)

Expand Down
Loading

[8]ページ先頭

©2009-2026 Movatter.jp