]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-135755: Move SPECIAL_ constants to a private header (GH-135922)
authorPetr Viktorin <encukou@gmail.com>
Wed, 25 Jun 2025 11:03:05 +0000 (13:03 +0200)
committerGitHub <noreply@github.com>
Wed, 25 Jun 2025 11:03:05 +0000 (13:03 +0200)
Macros without a `Py`/`_Py` prefix should not be defined in public headers.

Include/ceval.h
Include/internal/pycore_ceval.h
Modules/_opcode.c
Python/ceval.c
Python/codegen.c

index 32ab38972e548f32770b230eb9e3357a6aae0867..e9df8684996e23f32bda8b8a0d0ef2888f4efade 100644 (file)
@@ -133,13 +133,6 @@ PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
 #define FVS_MASK      0x4
 #define FVS_HAVE_SPEC 0x4
 
-/* Special methods used by LOAD_SPECIAL */
-#define SPECIAL___ENTER__   0
-#define SPECIAL___EXIT__    1
-#define SPECIAL___AENTER__  2
-#define SPECIAL___AEXIT__   3
-#define SPECIAL_MAX   3
-
 #ifndef Py_LIMITED_API
 #  define Py_CPYTHON_CEVAL_H
 #  include "cpython/ceval.h"
index 18623cc8f1c9458aa38e18a9d27c57dd8fc981b9..cc2defbdf77821cfa6210dd0549b311d2878db35 100644 (file)
@@ -366,6 +366,13 @@ extern int _PyRunRemoteDebugger(PyThreadState *tstate);
 PyAPI_FUNC(_PyStackRef)
 _PyForIter_VirtualIteratorNext(PyThreadState* tstate, struct _PyInterpreterFrame* frame, _PyStackRef iter, _PyStackRef *index_ptr);
 
+/* Special methods used by LOAD_SPECIAL */
+#define SPECIAL___ENTER__   0
+#define SPECIAL___EXIT__    1
+#define SPECIAL___AENTER__  2
+#define SPECIAL___AEXIT__   3
+#define SPECIAL_MAX   3
+
 #ifdef __cplusplus
 }
 #endif
index c295f7b3152577f6adeabc82c37160a6849889da..ef271b6ef566b9705d329ed28dce1ec5190b538f 100644 (file)
@@ -5,7 +5,7 @@
 #include "Python.h"
 #include "compile.h"
 #include "opcode.h"
-#include "pycore_ceval.h"
+#include "pycore_ceval.h"           // SPECIAL_MAX
 #include "pycore_code.h"
 #include "pycore_compile.h"
 #include "pycore_intrinsics.h"
index 3da6f61f5acde5fb9e9e50fb341ff83afbd1fb52..d1de4875656fd3371c707e25cbe07eb2ec42b542 100644 (file)
@@ -8,7 +8,7 @@
 #include "pycore_backoff.h"
 #include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_cell.h"          // PyCell_GetRef()
-#include "pycore_ceval.h"
+#include "pycore_ceval.h"         // SPECIAL___ENTER__
 #include "pycore_code.h"
 #include "pycore_dict.h"
 #include "pycore_emscripten_signal.h"  // _Py_CHECK_EMSCRIPTEN_SIGNALS
index 0023d72cd5e91d58b1b70e8b9711638a2434cafd..27fe8e1957b2fef7c8d71fb866928e3b866db9ce 100644 (file)
@@ -28,6 +28,7 @@
 #include "pycore_pystate.h"       // _Py_GetConfig()
 #include "pycore_symtable.h"      // PySTEntryObject
 #include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString
+#include "pycore_ceval.h"         // SPECIAL___ENTER__
 
 #define NEED_OPCODE_METADATA
 #include "pycore_opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed