summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-08-13 13:22:57 (GMT)
committerGitHub <noreply@github.com>2024-08-13 13:22:57 (GMT)
commit7a65439b93d6ee4d4e32757b55909b882f9a2056 (patch)
tree0df6d926c920125cf98e02ab7d8c0612565b055e /Python/specialize.c
parentfe23f8ed970425828de20fb48750fa89da914886 (diff)
downloadcpython-7a65439b93d6ee4d4e32757b55909b882f9a2056.zip
cpython-7a65439b93d6ee4d4e32757b55909b882f9a2056.tar.gz
cpython-7a65439b93d6ee4d4e32757b55909b882f9a2056.tar.bz2
GH-122390: Replace `_Py_GetbaseOpcode` with `_Py_GetBaseCodeUnit` (GH-122942)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index c354a90..4a22738 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -428,9 +428,9 @@ _PyCode_Quicken(PyCodeObject *code)
#if ENABLE_SPECIALIZATION
int opcode = 0;
_Py_CODEUNIT *instructions = _PyCode_CODE(code);
- for (int i = 0; i < Py_SIZE(code); i++) {
- opcode = _Py_GetBaseOpcode(code, i);
- assert(opcode < MIN_INSTRUMENTED_OPCODE);
+ /* The last code unit cannot have a cache, so we don't need to check it */
+ for (int i = 0; i < Py_SIZE(code)-1; i++) {
+ opcode = instructions[i].op.code;
int caches = _PyOpcode_Caches[opcode];
if (caches) {
// The initial value depends on the opcode