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

Skip to content

Commit 48a96d2

Browse files
[3.13] gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644) (#121729)
gh-120642: Move _PyCode_CODE() to the internal C API (GH-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. (cherry picked from commit a2bec77) Co-authored-by: Victor Stinner <[email protected]>
1 parent e0643d9 commit 48a96d2

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
@@ -30,6 +30,9 @@ typedef union {
3030
_Py_BackoffCounter counter; // First cache entry of specializable op
3131
} _Py_CODEUNIT;
3232

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

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

0 commit comments

Comments
 (0)