]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-149685: Use the _Py prefix for private C macros (GH-149686) (GH-149790)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 13 May 2026 21:29:08 +0000 (23:29 +0200)
committerGitHub <noreply@github.com>
Wed, 13 May 2026 21:29:08 +0000 (23:29 +0200)
(cherry picked from commit 125f26358ac7ecab98095fa85490e5465bdad698)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Include/cpython/sentinelobject.h
Include/cpython/sliceobject.h
Include/cpython/structseq.h
Include/internal/pycore_jit_unwind.h
Include/internal/pycore_mmap.h
Include/sliceobject.h
Include/structseq.h
Python/pystrhex.c
configure
configure.ac
pyconfig.h.in

index 8d5b1886ce543686e986c9d011cf0ead6953e068..15643ef966af86e4ecf30902f66415f3b70c1f97 100644 (file)
@@ -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 */
index 4c3ea1facebc4ed463bb4dae58d25c195cb388f3..137206eff15b33fa1938e4c14a9d15d887cc8d2f 100644 (file)
@@ -1,4 +1,4 @@
-#ifndef Py_CPYTHON_SLICEOBJECT_H
+#ifndef _Py_CPYTHON_SLICEOBJECT_H
 #  error "this header file must not be included directly"
 #endif
 
index 328fbe86143b02432fee6fc92a116b562d3ef81d..83a1abcd6f3b347a6fa99efdc86eef3bbedb4c78 100644 (file)
@@ -1,4 +1,4 @@
-#ifndef Py_CPYTHON_STRUCTSEQ_H
+#ifndef _Py_CPYTHON_STRUCTSEQ_H
 #  error "this header file must not be included directly"
 #endif
 
index 508caee97c43ab51d286767c50a17c087a438a19..7099b88812ce7be6c5bc9f169a6774c05aa0a071 100644 (file)
@@ -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
index 897816db01077f6772998ea48d47ae8b9cebdaf0..c117cbd16283da9d3da079e65599b111c5da7769 100644 (file)
@@ -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)
 {
index 00c70a6e911b417daf458ca05e68df9d5cc59f8e..9d6a16da95fe2f59f1838b74d2a763055b53d64f 100644 (file)
@@ -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
index e52d6188030af9d2ddede71ef3fdfb0d2b410924..e5da785f13d46b8443c9a80a7fc589c8c3ac1508 100644 (file)
@@ -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
index 645bb013581288e2548eda1b35ff49fbff937912..8fb1fa36f85e73943cf5bd21bfc8dd867787abea 100644 (file)
@@ -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);
         }
index cff7dfbfba8b9ada5746538bdddd5b7b128a4dc1..e9672d74c52a36698f66f6f8ff52b71415bc9d63 100755 (executable)
--- a/configure
+++ b/configure
@@ -14619,7 +14619,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
@@ -19483,7 +19483,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
@@ -24582,7 +24582,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
 
index ac3269ab765c0dffed1dc45382271c5de8d6da53..7f97db73ad807dcf147e2a9bf8abdd6170bf41a9 100644 (file)
@@ -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.])
 ])
 
@@ -5163,7 +5163,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)])
@@ -5788,7 +5788,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>
index ad372255445d1387fdcf8869165629a9b456bf14..7ef83fcd0b9e0bfc868b7dcda2d50b097655d34a 100644 (file)
 /* 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
 
 /* 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
 
 /* 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
 
 /* 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