@@ -397,8 +397,10 @@ lookup_attr(JitOptContext *ctx, _PyBloomFilter *dependencies, _PyUOpInstruction
397397 if (suffix != _NOP ) {
398398 ADD_OP (suffix , 2 , 0 );
399399 }
400- PyType_Watch (TYPE_WATCHER_ID , (PyObject * )type );
401- _Py_BloomFilter_Add (dependencies , type );
400+ if ((type -> tp_flags & Py_TPFLAGS_IMMUTABLETYPE ) == 0 ) {
401+ PyType_Watch (TYPE_WATCHER_ID , (PyObject * )type );
402+ _Py_BloomFilter_Add (dependencies , type );
403+ }
402404 return sym_new_const (ctx , lookup );
403405 }
404406 }
@@ -466,10 +468,12 @@ lookup_super_attr(JitOptContext *ctx, _PyBloomFilter *dependencies,
466468 if (suffix != _NOP ) {
467469 ADD_OP (suffix , 2 , 0 );
468470 }
469- PyType_Watch (TYPE_WATCHER_ID , (PyObject * )su_type );
470- _Py_BloomFilter_Add (dependencies , su_type );
471- PyType_Watch (TYPE_WATCHER_ID , (PyObject * )obj_type );
472- _Py_BloomFilter_Add (dependencies , obj_type );
471+ if ((obj_type -> tp_flags & Py_TPFLAGS_IMMUTABLETYPE ) == 0 ) {
472+ PyType_Watch (TYPE_WATCHER_ID , (PyObject * )su_type );
473+ _Py_BloomFilter_Add (dependencies , su_type );
474+ PyType_Watch (TYPE_WATCHER_ID , (PyObject * )obj_type );
475+ _Py_BloomFilter_Add (dependencies , obj_type );
476+ }
473477 return sym_new_const_steal (ctx , lookup );
474478}
475479
0 commit comments