summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2022-04-05 10:18:30 (GMT)
committerGitHub <noreply@github.com>2022-04-05 10:18:30 (GMT)
commit6c6e0408a663c1f53dad403f54a18d444da39cb7 (patch)
treec4765221f266993c2f633587c11811dcb9d10fd5 /Python/specialize.c
parent96e09837fb8031aebe8d823dd19ef664a34bcfad (diff)
downloadcpython-6c6e0408a663c1f53dad403f54a18d444da39cb7.zip
cpython-6c6e0408a663c1f53dad403f54a18d444da39cb7.tar.gz
cpython-6c6e0408a663c1f53dad403f54a18d444da39cb7.tar.bz2
bpo-47009: Let PRECALL_NO_KW_LIST_APPEND do its own POP_TOP (GH-32239)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 08c6904..36b0502 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1435,7 +1435,10 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
}
PyInterpreterState *interp = _PyInterpreterState_GET();
PyObject *list_append = interp->callable_cache.list_append;
- if ((PyObject *)descr == list_append && oparg == 1) {
+ _Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_PRECALL + 1
+ + INLINE_CACHE_ENTRIES_CALL + 1];
+ bool pop = (_Py_OPCODE(next) == POP_TOP);
+ if ((PyObject *)descr == list_append && oparg == 1 && pop) {
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_LIST_APPEND);
return 0;
}