https://github.com/python/cpython/commit/125f26358ac7ecab98095fa85490e5465bdad698
commit: 125f26358ac7ecab98095fa85490e5465bdad698
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-05-13T19:14:05+02:00
summary:
gh-149685: Use the _Py prefix for private C macros (GH-149686)
files:
M Include/cpython/sentinelobject.h
M Include/cpython/sliceobject.h
M Include/cpython/structseq.h
M Include/internal/pycore_jit_unwind.h
M Include/internal/pycore_mmap.h
M Include/sliceobject.h
M Include/structseq.h
M Python/pystrhex.c
M configure
M configure.ac
M pyconfig.h.in
diff --git a/Include/cpython/sentinelobject.h b/Include/cpython/sentinelobject.h
index 8d5b1886ce5436..15643ef966af86 100644
--- a/Include/cpython/sentinelobject.h
+++ b/Include/cpython/sentinelobject.h
@@ -1,8 +1,8 @@
/* Sentinel object interface */
#ifndef Py_LIMITED_API
-#ifndef Py_SENTINELOBJECT_H
-#define Py_SENTINELOBJECT_H
+#ifndef _Py_SENTINELOBJECT_H
+#define _Py_SENTINELOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
@@ -21,5 +21,5 @@ PyAPI_FUNC(PyObject *) PySentinel_New(
#ifdef __cplusplus
}
#endif
-#endif /* !Py_SENTINELOBJECT_H */
+#endif /* !_Py_SENTINELOBJECT_H */
#endif /* !Py_LIMITED_API */
diff --git a/Include/cpython/sliceobject.h b/Include/cpython/sliceobject.h
index 4c3ea1facebc4e..137206eff15b33 100644
--- a/Include/cpython/sliceobject.h
+++ b/Include/cpython/sliceobject.h
@@ -1,4 +1,4 @@
-#ifndef Py_CPYTHON_SLICEOBJECT_H
+#ifndef _Py_CPYTHON_SLICEOBJECT_H
# error "this header file must not be included directly"
#endif
diff --git a/Include/cpython/structseq.h b/Include/cpython/structseq.h
index 328fbe86143b02..83a1abcd6f3b34 100644
--- a/Include/cpython/structseq.h
+++ b/Include/cpython/structseq.h
@@ -1,4 +1,4 @@
-#ifndef Py_CPYTHON_STRUCTSEQ_H
+#ifndef _Py_CPYTHON_STRUCTSEQ_H
# error "this header file must not be included directly"
#endif
diff --git a/Include/internal/pycore_jit_unwind.h
b/Include/internal/pycore_jit_unwind.h
index 508caee97c43ab..7099b88812ce7b 100644
--- a/Include/internal/pycore_jit_unwind.h
+++ b/Include/internal/pycore_jit_unwind.h
@@ -11,7 +11,7 @@
#if defined(_Py_JIT) && defined(__linux__) && defined(__ELF__)
# define PY_HAVE_JIT_GDB_UNWIND
# if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
- defined(HAVE_LIBGCC_EH_FRAME_REGISTRATION)
+ defined(_Py_HAVE_LIBGCC_EH_FRAME_REGISTRATION)
# define PY_HAVE_JIT_GNU_BACKTRACE_UNWIND
# endif
#endif
diff --git a/Include/internal/pycore_mmap.h b/Include/internal/pycore_mmap.h
index 897816db01077f..c117cbd16283da 100644
--- a/Include/internal/pycore_mmap.h
+++ b/Include/internal/pycore_mmap.h
@@ -11,12 +11,12 @@ extern "C" {
#include "pycore_pystate.h"
-#if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
+#if defined(_Py_HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
# include <linux/prctl.h>
# include <sys/prctl.h>
#endif
-#if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
+#if defined(_Py_HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
static inline int
_PyAnnotateMemoryMap(void *addr, size_t size, const char *name)
{
diff --git a/Include/sliceobject.h b/Include/sliceobject.h
index 00c70a6e911b41..9d6a16da95fe2f 100644
--- a/Include/sliceobject.h
+++ b/Include/sliceobject.h
@@ -45,9 +45,9 @@ PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t
length,
#endif
#ifndef Py_LIMITED_API
-# define Py_CPYTHON_SLICEOBJECT_H
+# define _Py_CPYTHON_SLICEOBJECT_H
# include "cpython/sliceobject.h"
-# undef Py_CPYTHON_SLICEOBJECT_H
+# undef _Py_CPYTHON_SLICEOBJECT_H
#endif
#ifdef __cplusplus
diff --git a/Include/structseq.h b/Include/structseq.h
index e52d6188030af9..e5da785f13d46b 100644
--- a/Include/structseq.h
+++ b/Include/structseq.h
@@ -29,9 +29,9 @@ PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*,
Py_ssize_t, PyObject*);
PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
#ifndef Py_LIMITED_API
-# define Py_CPYTHON_STRUCTSEQ_H
+# define _Py_CPYTHON_STRUCTSEQ_H
# include "cpython/structseq.h"
-# undef Py_CPYTHON_STRUCTSEQ_H
+# undef _Py_CPYTHON_STRUCTSEQ_H
#endif
#ifdef __cplusplus
diff --git a/Python/pystrhex.c b/Python/pystrhex.c
index 645bb013581288..8fb1fa36f85e73 100644
--- a/Python/pystrhex.c
+++ b/Python/pystrhex.c
@@ -36,7 +36,7 @@ _Py_hexlify_scalar(const unsigned char *src, Py_UCS1 *dst,
Py_ssize_t len)
adds a ton of complication. Who ever really hexes huge data?
The 16-64 byte boosts align nicely with md5 - sha512 hexdigests.
*/
-#ifdef HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
+#ifdef _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
/* 128-bit vector of 16 unsigned bytes */
typedef unsigned char v16u8 __attribute__((vector_size(16)));
@@ -110,7 +110,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst,
Py_ssize_t len)
_Py_hexlify_scalar(src + i, dst, len - i);
}
-#endif /* HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR */
+#endif /* _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR */
static PyObject *
_Py_strhex_impl(const char* argbuf, Py_ssize_t arglen,
@@ -191,7 +191,7 @@ _Py_strhex_impl(const char* argbuf, Py_ssize_t arglen,
unsigned char c;
if (bytes_per_sep_group == 0) {
-#ifdef HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
+#ifdef _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
if (arglen >= 16) {
_Py_hexlify_simd((const unsigned char *)argbuf, retbuf, arglen);
}
diff --git a/configure b/configure
index f3489d0fae09b7..4453237b06b5b7 100755
--- a/configure
+++ b/configure
@@ -14616,7 +14616,7 @@ if test "x$ac_cv_have_libgcc_eh_frame_registration" =
xyes
then :
-printf "%s\n" "#define HAVE_LIBGCC_EH_FRAME_REGISTRATION 1" >>confdefs.h
+printf "%s\n" "#define _Py_HAVE_LIBGCC_EH_FRAME_REGISTRATION 1" >>confdefs.h
fi
@@ -19421,7 +19421,7 @@ if test "x$ac_cv_efficient_builtin_shufflevector" = xyes
then :
-printf "%s\n" "#define HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR 1" >>confdefs.h
+printf "%s\n" "#define _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR 1" >>confdefs.h
fi
@@ -24520,7 +24520,7 @@ printf "%s\n" "#define HAVE_DECL_PR_SET_VMA_ANON_NAME
$ac_have_decl" >>confdefs.
if test $ac_have_decl = 1
then :
-printf "%s\n" "#define HAVE_PR_SET_VMA_ANON_NAME 1" >>confdefs.h
+printf "%s\n" "#define _Py_HAVE_PR_SET_VMA_ANON_NAME 1" >>confdefs.h
fi
diff --git a/configure.ac b/configure.ac
index 1bb845835ff68e..87e8abdf3852d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3863,7 +3863,7 @@ __deregister_frame(0);
[ac_cv_have_libgcc_eh_frame_registration=no])
])
AS_VAR_IF([ac_cv_have_libgcc_eh_frame_registration], [yes], [
- AC_DEFINE([HAVE_LIBGCC_EH_FRAME_REGISTRATION], [1],
+ AC_DEFINE([_Py_HAVE_LIBGCC_EH_FRAME_REGISTRATION], [1],
[Define to 1 if libgcc __register_frame and __deregister_frame are
linkable.])
])
@@ -5079,7 +5079,7 @@ AC_LINK_IFELSE([
])
AS_VAR_IF([ac_cv_efficient_builtin_shufflevector], [yes], [
- AC_DEFINE([HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR], [1],
+ AC_DEFINE([_Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR], [1],
[Define if compiler supports __builtin_shufflevector with 128-bit
vectors AND the target architecture has native SIMD (not just
API
availability)])
@@ -5704,7 +5704,7 @@ AC_CHECK_DECLS([UT_NAMESIZE],
# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h
AS_IF([test "$ac_cv_libc" != musl], [
AC_CHECK_DECLS([PR_SET_VMA_ANON_NAME],
- [AC_DEFINE([HAVE_PR_SET_VMA_ANON_NAME], [1],
+ [AC_DEFINE([_Py_HAVE_PR_SET_VMA_ANON_NAME], [1],
[Define if you have the 'PR_SET_VMA_ANON_NAME'
constant.])],
[],
[@%:@include <linux/prctl.h>
diff --git a/pyconfig.h.in b/pyconfig.h.in
index ad372255445d13..7ef83fcd0b9e0b 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -320,10 +320,6 @@
/* Define to 1 if you have the <editline/readline.h> header file. */
#undef HAVE_EDITLINE_READLINE_H
-/* Define if compiler supports __builtin_shufflevector with 128-bit vectors
- AND the target architecture has native SIMD (not just API availability) */
-#undef HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
-
/* Define to 1 if you have the <endian.h> header file. */
#undef HAVE_ENDIAN_H
@@ -701,10 +697,6 @@
/* Define to 1 if you have the 'dld' library (-ldld). */
#undef HAVE_LIBDLD
-/* Define to 1 if libgcc __register_frame and __deregister_frame are linkable.
- */
-#undef HAVE_LIBGCC_EH_FRAME_REGISTRATION
-
/* Define to 1 if you have the 'ieee' library (-lieee). */
#undef HAVE_LIBIEEE
@@ -1007,9 +999,6 @@
/* Define if your compiler supports function prototype */
#undef HAVE_PROTOTYPES
-/* Define if you have the 'PR_SET_VMA_ANON_NAME' constant. */
-#undef HAVE_PR_SET_VMA_ANON_NAME
-
/* Define to 1 if you have the 'pthread_condattr_setclock' function. */
#undef HAVE_PTHREAD_CONDATTR_SETCLOCK
@@ -2067,6 +2056,17 @@
/* HACL* library can compile SIMD256 implementations */
#undef _Py_HACL_CAN_COMPILE_VEC256
+/* Define if compiler supports __builtin_shufflevector with 128-bit vectors
+ AND the target architecture has native SIMD (not just API availability) */
+#undef _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
+
+/* Define to 1 if libgcc __register_frame and __deregister_frame are linkable.
+ */
+#undef _Py_HAVE_LIBGCC_EH_FRAME_REGISTRATION
+
+/* Define if you have the 'PR_SET_VMA_ANON_NAME' constant. */
+#undef _Py_HAVE_PR_SET_VMA_ANON_NAME
+
/* Define to 1 if the machine stack grows down (default); 0 if it grows up. */
#undef _Py_STACK_GROWS_DOWN
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]