gh-148380: remove all uses of _PyType_LookupByVersion in optimizer_bytecodes.c (GH-148394)

This commit is contained in:
Neko Asakura 2026-05-02 22:45:38 +08:00 committed by GitHub
parent efcac6f281
commit 2ca6333065
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 39 deletions

View file

@ -229,8 +229,8 @@ dummy_func(void) {
}
op(_CHECK_ATTR_CLASS, (type_version/2, owner -- owner)) {
PyObject *type = (PyObject *)_PyType_LookupByVersion(type_version);
if (type) {
PyObject *type = sym_get_probable_value(owner);
if (type != NULL && ((PyTypeObject *)type)->tp_version_tag == type_version) {
if (type == sym_get_const(ctx, owner)) {
ADD_OP(_NOP, 0, 0);
}
@ -246,7 +246,7 @@ dummy_func(void) {
op(_GUARD_TYPE_VERSION, (type_version/2, owner -- owner)) {
assert(type_version);
assert(this_instr[-1].opcode == _RECORD_TOS_TYPE);
assert(this_instr[-1].opcode == _RECORD_TOS_TYPE || this_instr[-1].opcode == _RECORD_TOS);
if (sym_matches_type_version(owner, type_version)) {
ADD_OP(_NOP, 0, 0);
}