Skip to content

Commit b08ef60

Browse files
allow allow deferred things to be borrrowed too
1 parent d84215d commit b08ef60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/optimizer_analysis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj, bool pop)
114114
if (res == NULL) {
115115
return NULL;
116116
}
117-
if (_Py_IsImmortal(res)) {
117+
if (_Py_IsImmortal(res) || _PyObject_HasDeferredRefcount(res)) {
118118
inst->opcode = pop ? _POP_TOP_LOAD_CONST_INLINE_BORROW : _LOAD_CONST_INLINE_BORROW;
119119
}
120120
else {
@@ -233,7 +233,7 @@ lookup_attr(JitOptContext *ctx, _PyUOpInstruction *this_instr,
233233
if (type && PyType_Check(type)) {
234234
PyObject *lookup = _PyType_Lookup(type, name);
235235
if (lookup) {
236-
int opcode = _Py_IsImmortal(lookup) ? immortal : mortal;
236+
int opcode = _Py_IsImmortal(lookup) || _PyObject_HasDeferredRefcount(lookup) ? immortal : mortal;
237237
REPLACE_OP(this_instr, opcode, 0, (uintptr_t)lookup);
238238
return sym_new_const(ctx, lookup);
239239
}

0 commit comments

Comments
 (0)