Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 1 addition & 6 deletions Include/pymacro.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#ifndef Py_PYMACRO_H
#define Py_PYMACRO_H

// _Py_STDC_VERSION: the version of the C standard.
// gh-160208: The C++ standard allows __STDC_VERSION__ to be defined to an
// arbitrary value, which means we can't use __STDC_VERSION__ on C++.
#if !defined(__cplusplus) && defined(__STDC_VERSION__)
# define _Py_STDC_VERSION __STDC_VERSION__
#endif
// _Py_STDC_VERSION is defined in pyport.h, which is included before this file.

// gh-91782: On FreeBSD 12, if the _POSIX_C_SOURCE and _XOPEN_SOURCE macros are
// defined, <sys/cdefs.h> disables C11 support and <assert.h> does not define
Expand Down
9 changes: 9 additions & 0 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
# error "Python's source code assumes C's unsigned char is an 8-bit type"
#endif

// _Py_STDC_VERSION: the version of the C standard.
// gh-160208: The C++ standard allows __STDC_VERSION__ to be defined to an
// arbitrary value, which means we can't use __STDC_VERSION__ on C++.
// gh-160719: Defined here, rather than in pymacro.h, because this file uses it
// and is included before pymacro.h.
#if !defined(__cplusplus) && defined(__STDC_VERSION__)
# define _Py_STDC_VERSION __STDC_VERSION__
#endif


// Preprocessor check for a builtin preprocessor function. Always return 0
// if __has_builtin() macro is not defined.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fix the C11 and C23 code paths in :file:`pyport.h` never being used: the
private ``_Py_STDC_VERSION`` macro was defined in :file:`pymacro.h`, which is
included after :file:`pyport.h`, so ``_Py_thread_local``, ``_Py_NULL`` and
``_Py_TYPEOF`` fell back to compiler extensions instead of ``_Thread_local``,
``nullptr`` and ``typeof``.
Loading