Skip to content

Commit 75500b1

Browse files
do not add type watchers for immutable types
1 parent 8e1469c commit 75500b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Python/optimizer_analysis.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,10 @@ lookup_attr(JitOptContext *ctx, _PyBloomFilter *dependencies, _PyUOpInstruction
369369
if (lookup) {
370370
int opcode = _Py_IsImmortal(lookup) ? immortal : mortal;
371371
ADD_OP(opcode, 0, (uintptr_t)lookup);
372-
PyType_Watch(TYPE_WATCHER_ID, (PyObject *)type);
373-
_Py_BloomFilter_Add(dependencies, type);
372+
if ((type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) == 0) {
373+
PyType_Watch(TYPE_WATCHER_ID, (PyObject *)type);
374+
_Py_BloomFilter_Add(dependencies, type);
375+
}
374376
return sym_new_const(ctx, lookup);
375377
}
376378
}

0 commit comments

Comments
 (0)