Skip to content

Commit a5e9d13

Browse files
committed
fix race with pythonGH-96519 (removed func_version in LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN specialization)
1 parent 5340e87 commit a5e9d13

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Python/specialize.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,11 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
836836
if (!function_check_args(descr, 2, LOAD_ATTR)) {
837837
goto fail;
838838
}
839-
write_u32(lm_cache->keys_version, func_version);
839+
uint32_t version = function_get_version(descr, LOAD_ATTR);
840+
if (version == 0) {
841+
goto fail;
842+
}
843+
write_u32(lm_cache->keys_version, version);
840844
/* borrowed */
841845
write_obj(lm_cache->descr, descr);
842846
write_u32(lm_cache->type_version, type->tp_version_tag);

0 commit comments

Comments
 (0)