[3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135… · fedora-python/cpython@a345fed · GitHub
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

5 files changed

Lines changed: 10 additions & 9 deletions

File tree

Include/ceval.h

Lines changed: 0 additions & 7 deletions

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

0 commit comments

Comments
 (0)