Fedora Account System
Red Hat Associate
Red Hat Customer
After upgrading python3-devel from 0:3.15.1-1.fc46.x86_64 to 0:3.15.2-1.fc46.x86_64, building Python extensions with -Werror=undef fails: $ echo '#include <Python.h>' | gcc -x c -Werror=undef -I/usr/include/python3.15 -c - In file included from /usr/include/python3.15/Python.h:68, from <stdin>:1: /usr/include/python3.15/pyport.h:494:9: error: ‘_Py_STDC_VERSION’ is not defined, evaluates to ‘0’ [-Werror=undef] 494 | # elif _Py_STDC_VERSION >= 201112L && !defined(__STDC_NO_THREADS__) | ^~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors The cause is a missing check for _Py_STDC_VERSION definition before comparing _Py_STDC_VERSION value in /usr/include/python3.15/pyport.h: It reads: # elif _Py_STDC_VERSION >= 201112L && !defined(__STDC_NO_THREADS__) and it should be: # elif defined(_Py_STDC_VERSION) && _Py_STDC_VERSION >= 201112L && !defined(__STDC_NO_THREADS__) Compare to changes made in /usr/include/python3.15/pyport.h between the two version: @@ -50,7 +50,7 @@ // to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer, // _Py_NULL is defined as nullptr. #if !defined(_MSC_VER) && \ - ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) \ + ((defined (_Py_STDC_VERSION) && _Py_STDC_VERSION >= 202311L) \ || (defined(__cplusplus) && __cplusplus >= 201103)) # define _Py_NULL nullptr #else @@ -491,7 +491,7 @@ #ifdef WITH_THREAD # ifdef thread_local # define _Py_thread_local thread_local -# elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__) +# elif _Py_STDC_VERSION >= 201112L && !defined(__STDC_NO_THREADS__) # define _Py_thread_local _Thread_local # elif defined(_MSC_VER) /* AKA NT_THREADS */ # define _Py_thread_local __declspec(thread) @@ -543,7 +543,7 @@ // // gh-157649: Do not use decltype() on C++, since it produces invalid code in // Py_CLEAR()/Py_SETREF(). -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#if defined (_Py_STDC_VERSION) && _Py_STDC_VERSION >= 202311L # define _Py_TYPEOF(expr) typeof(expr) #elif (defined(__GNUC__) || defined(__clang__) \ || (defined(_MSC_VER) && _MSC_VER >= 1939 && !defined(__cplusplus)))
I reported this upstream for C++ long time ago. It seems that after the recent change, it also applies on C which is regression from 3.15.0. I'll try to bump my upstream report. Petr, how much is this blocking you, should we backport a fix?
I know only about libloc package failing to build because of this. I don't have any need to rebuild it right now. I can work around it by removing -Werror=undef option from the libloc's default cflags. But fixing it on Python side in a few months would be great.
I anticipate this fixed in Python 3.15.3 currently scheduled for 2026-12-01