gh-148871: Add CONSTANT_EMPTY_TUPLE to LOAD_COMMON_CONSTANT (GH-149688)

This commit is contained in:
Pieter Eendebak 2026-05-21 16:54:46 +02:00 committed by GitHub
parent c35b0f2b62
commit f2fa291db8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 20 additions and 9 deletions

View file

@ -1468,6 +1468,10 @@ maybe_instr_make_load_common_const(cfg_instr *instr, PyObject *newconst)
&& PyUnicode_GET_LENGTH(newconst) == 0) {
oparg = CONSTANT_EMPTY_STR;
}
else if (PyTuple_CheckExact(newconst)
&& PyTuple_GET_SIZE(newconst) == 0) {
oparg = CONSTANT_EMPTY_TUPLE;
}
else if (PyLong_CheckExact(newconst)) {
int overflow;
long val = PyLong_AsLongAndOverflow(newconst, &overflow);