mirror of
https://github.com/python/cpython.git
synced 2024-12-12 03:04:15 +08:00
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.
This commit is contained in:
parent
b5805892d5
commit
a2bec77d25
@ -194,9 +194,6 @@ Py_DEPRECATED(3.13) static inline int PyCode_GetFirstFree(PyCodeObject *op) {
|
|||||||
return PyUnstable_Code_GetFirstFree(op);
|
return PyUnstable_Code_GetFirstFree(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _PyCode_CODE(CO) _Py_RVALUE((_Py_CODEUNIT *)(CO)->co_code_adaptive)
|
|
||||||
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))
|
|
||||||
|
|
||||||
/* Unstable public interface */
|
/* Unstable public interface */
|
||||||
PyAPI_FUNC(PyCodeObject *) PyUnstable_Code_New(
|
PyAPI_FUNC(PyCodeObject *) PyUnstable_Code_New(
|
||||||
int, int, int, int, int, PyObject *, PyObject *,
|
int, int, int, int, int, PyObject *, PyObject *,
|
||||||
|
@ -31,6 +31,9 @@ typedef union {
|
|||||||
_Py_BackoffCounter counter; // First cache entry of specializable op
|
_Py_BackoffCounter counter; // First cache entry of specializable op
|
||||||
} _Py_CODEUNIT;
|
} _Py_CODEUNIT;
|
||||||
|
|
||||||
|
#define _PyCode_CODE(CO) _Py_RVALUE((_Py_CODEUNIT *)(CO)->co_code_adaptive)
|
||||||
|
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))
|
||||||
|
|
||||||
|
|
||||||
/* These macros only remain defined for compatibility. */
|
/* These macros only remain defined for compatibility. */
|
||||||
#define _Py_OPCODE(word) ((word).op.code)
|
#define _Py_OPCODE(word) ((word).op.code)
|
||||||
|
Loading…
Reference in New Issue
Block a user