Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2bec77

Browse files
authored
gh-120642: Move _PyCode_CODE() to the internal C API (#121644)
Move _PyCode_CODE() and _PyCode_NBYTES() macros to the internal C API since they use _Py_CODEUNIT which is only part of the internal C API.
1 parent b580589 commit a2bec77

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Include/cpython/code.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ Py_DEPRECATED(3.13) static inline int PyCode_GetFirstFree(PyCodeObject *op) {
194194
return PyUnstable_Code_GetFirstFree(op);
195195
}
196196

197-
#define _PyCode_CODE(CO) _Py_RVALUE((_Py_CODEUNIT *)(CO)->co_code_adaptive)
198-
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))
199-
200197
/* Unstable public interface */
201198
PyAPI_FUNC(PyCodeObject *) PyUnstable_Code_New(
202199
int, int, int, int, int, PyObject *, PyObject *,

Include/internal/pycore_code.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ typedef union {
3131
_Py_BackoffCounter counter; // First cache entry of specializable op
3232
} _Py_CODEUNIT;
3333

34+
#define _PyCode_CODE(CO) _Py_RVALUE((_Py_CODEUNIT *)(CO)->co_code_adaptive)
35+
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))
36+
3437

3538
/* These macros only remain defined for compatibility. */
3639
#define _Py_OPCODE(word) ((word).op.code)

0 commit comments

Comments
 (0)