Skip to content

Commit a345fed

Browse files
authored
[3.14] pythongh-135755: Move SPECIAL_ constants to a private header (pythonGH-135922) (pythonGH-135926)
Macros without a `Py`/`_Py` prefix should not be defined in public headers. (cherry picked from commit 1b1ae82)
1 parent 93a31be commit a345fed

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Include/ceval.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,6 @@ PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
133133
#define FVS_MASK 0x4
134134
#define FVS_HAVE_SPEC 0x4
135135

136-
/* Special methods used by LOAD_SPECIAL */
137-
#define SPECIAL___ENTER__ 0
138-
#define SPECIAL___EXIT__ 1
139-
#define SPECIAL___AENTER__ 2
140-
#define SPECIAL___AEXIT__ 3
141-
#define SPECIAL_MAX 3
142-
143136
#ifndef Py_LIMITED_API
144137
# define Py_CPYTHON_CEVAL_H
145138
# include "cpython/ceval.h"

Include/internal/pycore_ceval.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ PyAPI_FUNC(_PyStackRef) _PyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyS
363363
extern int _PyRunRemoteDebugger(PyThreadState *tstate);
364364
#endif
365365

366+
/* Special methods used by LOAD_SPECIAL */
367+
#define SPECIAL___ENTER__ 0
368+
#define SPECIAL___EXIT__ 1
369+
#define SPECIAL___AENTER__ 2
370+
#define SPECIAL___AEXIT__ 3
371+
#define SPECIAL_MAX 3
372+
366373
#ifdef __cplusplus
367374
}
368375
#endif

Modules/_opcode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "Python.h"
66
#include "compile.h"
77
#include "opcode.h"
8-
#include "pycore_ceval.h"
8+
#include "pycore_ceval.h" // SPECIAL_MAX
99
#include "pycore_code.h"
1010
#include "pycore_compile.h"
1111
#include "pycore_intrinsics.h"

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "pycore_backoff.h"
99
#include "pycore_call.h" // _PyObject_CallNoArgs()
1010
#include "pycore_cell.h" // PyCell_GetRef()
11-
#include "pycore_ceval.h"
11+
#include "pycore_ceval.h" // SPECIAL___ENTER__
1212
#include "pycore_code.h"
1313
#include "pycore_dict.h"
1414
#include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS

Python/codegen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "pycore_pystate.h" // _Py_GetConfig()
2929
#include "pycore_symtable.h" // PySTEntryObject
3030
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString
31+
#include "pycore_ceval.h" // SPECIAL___ENTER__
3132

3233
#define NEED_OPCODE_METADATA
3334
#include "pycore_opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed

0 commit comments

Comments
 (0)