8000 gh-135755: Move SPECIAL_ constants to a private header (GH-135922) · python/cpython@1b1ae82 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b1ae82

Browse files
authored
gh-135755: Move SPECIAL_ constants to a private header (GH-135922)
Macros without a `Py`/`_Py` prefix should not be defined in public headers.
1 parent dd59c78 commit 1b1ae82

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
@@ -366,6 +366,13 @@ extern int _PyRunRemoteDebugger(PyThreadState *tstate);
366366
PyAPI_FUNC(_PyStackRef)
367367
_PyForIter_VirtualIteratorNext(PyThreadState* tstate, struct _PyInterpreterFrame* frame, _PyStackRef iter, _PyStackRef *index_ptr);
368368

369+
/* Special methods used by LOAD_SPECIAL */
370+
#define SPECIAL___ENTER__ 0
371+
#define SPECIAL___EXIT__ 1
372+
#define SPECIAL___AENTER__ 2
373+
#define SPECIAL___AEXIT__ 3
374+
#define SPECIAL_MAX 3
375+
369376
#ifdef __cplusplus
370377
}
371378
#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)
0