https://github.com/python/cpython/commit/a345fed89643620ccc198dcd332c17db80069882
commit: a345fed89643620ccc198dcd332c17db80069882
branch: 3.14
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2025-06-25T13:36:46+02:00
summary:

[3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135922) 
(GH-135926)

Macros without a `Py`/`_Py` prefix should not be defined in public headers.
(cherry picked from commit 1b1ae82fab0093924b8b89eb1c7eea11d7be7b18)

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

diff --git a/Include/ceval.h b/Include/ceval.h
index 32ab38972e548f..e9df8684996e23 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -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"
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 2c678cd97df79c..528154c93348d2 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -363,6 +363,13 @@ PyAPI_FUNC(_PyStackRef) 
_PyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyS
 extern int _PyRunRemoteDebugger(PyThreadState *tstate);
 #endif
 
+/* 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
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index c295f7b3152577..ef271b6ef566b9 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -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"
diff --git a/Python/ceval.c b/Python/ceval.c
index 12d9011f5c7ee2..bacadd0f3aeb6a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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
diff --git a/Python/codegen.c b/Python/codegen.c
index d708e59ed67baf..b3dbed7096489b 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -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

_______________________________________________
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]

Reply via email to