@@ -149,10 +149,7 @@ dummy_func(void) {
149149 // Promote the probable type version to a known one.
150150 sym_set_type (owner , probable_type );
151151 sym_set_type_version (owner , type_version );
152- if ((probable_type -> tp_flags & Py_TPFLAGS_IMMUTABLETYPE ) == 0 ) {
153- PyType_Watch (TYPE_WATCHER_ID , (PyObject * )probable_type );
154- _Py_BloomFilter_Add (dependencies , probable_type );
155- }
152+ watch_type (probable_type , dependencies );
156153 }
157154 else {
158155 ctx -> contradiction = true;
@@ -238,10 +235,7 @@ dummy_func(void) {
238235 }
239236 else {
240237 sym_set_const (owner , type );
241- if ((((PyTypeObject * )type )-> tp_flags & Py_TPFLAGS_IMMUTABLETYPE ) == 0 ) {
242- PyType_Watch (TYPE_WATCHER_ID , type );
243- _Py_BloomFilter_Add (dependencies , type );
244- }
238+ watch_type ((PyTypeObject * )type , dependencies );
245239 }
246240 }
247241 }
@@ -258,8 +252,7 @@ dummy_func(void) {
258252 probable_type -> tp_version_tag == type_version ) {
259253 sym_set_type (owner , probable_type );
260254 sym_set_type_version (owner , type_version );
261- PyType_Watch (TYPE_WATCHER_ID , (PyObject * )probable_type );
262- _Py_BloomFilter_Add (dependencies , probable_type );
255+ watch_type (probable_type , dependencies );
263256 }
264257 else {
265258 ctx -> contradiction = true;
@@ -1326,8 +1319,7 @@ dummy_func(void) {
13261319 assert (init != NULL );
13271320 assert (PyFunction_Check (init ));
13281321 callable = sym_new_const (ctx , init );
1329- PyType_Watch (TYPE_WATCHER_ID , callable_o );
1330- _Py_BloomFilter_Add (dependencies , callable_o );;
1322+ watch_type ((PyTypeObject * )callable_o , dependencies );
13311323 }
13321324 else {
13331325 callable = sym_new_not_null (ctx );
@@ -2033,10 +2025,7 @@ dummy_func(void) {
20332025 0 , (uintptr_t )descr );
20342026 ADD_OP (_SWAP , 3 , 0 );
20352027 optimize_pop_top (ctx , this_instr , method_and_self [0 ]);
2036- if ((type -> tp_flags & Py_TPFLAGS_IMMUTABLETYPE ) == 0 ) {
2037- PyType_Watch (TYPE_WATCHER_ID , (PyObject * )type );
2038- _Py_BloomFilter_Add (dependencies , type );
2039- }
2028+ watch_type (type , dependencies );
20402029 method_and_self [0 ] = sym_new_const (ctx , descr );
20412030 optimized = true;
20422031 }
0 commit comments