Skip to content

Commit d29b3aa

Browse files
committed
Checkpoint LOAD_ATTR_GETATTRIBUTE_OVERRIDEN
1 parent 8dac8c4 commit d29b3aa

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,7 @@ dummy_func(
23372337
DEOPT_IF(tstate->interp->eval_frame);
23382338
PyTypeObject *cls = Py_TYPE(owner_o);
23392339
assert(type_version != 0);
2340-
DEOPT_IF(cls->tp_version_tag != type_version);
2340+
DEOPT_IF(FT_ATOMIC_LOAD_UINT32_RELAXED(cls->tp_version_tag) != type_version);
23412341
assert(Py_IS_TYPE(getattribute, &PyFunction_Type));
23422342
PyFunctionObject *f = (PyFunctionObject *)getattribute;
23432343
assert(func_version != 0);

Python/generated_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/specialize.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,6 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
12521252
{
12531253
assert(type->tp_getattro == _Py_slot_tp_getattro);
12541254
assert(Py_IS_TYPE(descr, &PyFunction_Type));
1255-
FT_UNIMPLEMENTED();
12561255
_PyLoadMethodCache *lm_cache = (_PyLoadMethodCache *)(instr + 1);
12571256
if (!function_check_args(descr, 2, LOAD_ATTR)) {
12581257
return -1;
@@ -1269,10 +1268,16 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
12691268
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OTHER);
12701269
return -1;
12711270
}
1271+
#ifdef Py_GIL_DISABLED
1272+
if (!_PyObject_HasDeferredRefcount(descr)) {
1273+
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_DESCR_NOT_DEFERRED);
1274+
return -1;
1275+
}
1276+
#endif
12721277
write_u32(lm_cache->keys_version, version);
12731278
/* borrowed */
12741279
write_obj(lm_cache->descr, descr);
1275-
write_u32(lm_cache->type_version, type->tp_version_tag);
1280+
write_u32(lm_cache->type_version, tp_version);
12761281
specialize(instr, LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN);
12771282
return 0;
12781283
}

0 commit comments

Comments
 (0)