@@ -228,20 +228,24 @@ static Object doIt(PythonAbstractNativeObject clazz,
228
228
229
229
@ CApiBuiltin (ret = ArgDescriptor .Void , args = {PyTypeObject }, call = Direct )
230
230
abstract static class PyType_Modified extends CApiUnaryBuiltinNode {
231
-
232
231
@ TruffleBoundary
233
232
@ Specialization
234
- static Object doIt (PythonAbstractNativeObject clazz ,
233
+ static Object doIt (PythonAbstractClass object ,
235
234
@ Bind ("this" ) Node inliningTarget ) {
236
- PythonContext context = PythonContext .get (inliningTarget );
237
- CyclicAssumption nativeClassStableAssumption = context .getNativeClassStableAssumption (clazz , false );
238
- if (nativeClassStableAssumption != null ) {
239
- nativeClassStableAssumption .invalidate ("PyType_Modified(\" " + TypeNodes .GetNameNode .executeUncached (clazz ).toJavaStringUncached () + "\" ) called" );
235
+ if (object instanceof PythonAbstractNativeObject clazz ) {
236
+ PythonContext context = PythonContext .get (inliningTarget );
237
+ CyclicAssumption nativeClassStableAssumption = context .getNativeClassStableAssumption (clazz , false );
238
+ if (nativeClassStableAssumption != null ) {
239
+ nativeClassStableAssumption .invalidate ("PyType_Modified(\" " + TypeNodes .GetNameNode .executeUncached (clazz ).toJavaStringUncached () + "\" ) called" );
240
+ }
241
+ MroSequenceStorage mroStorage = TypeNodes .GetMroStorageNode .executeUncached (clazz );
242
+ mroStorage .lookupChanged ();
243
+ // Reload slots from native, which also invalidates cached slot lookups
244
+ clazz .setTpSlots (TpSlots .fromNative (clazz , context ));
245
+ } else {
246
+ MroSequenceStorage mroStorage = TypeNodes .GetMroStorageNode .executeUncached (object );
247
+ mroStorage .lookupChanged ();
240
248
}
241
- MroSequenceStorage mroStorage = TypeNodes .GetMroStorageNode .executeUncached (clazz );
242
- mroStorage .lookupChanged ();
243
- // Reload slots from native, which also invalidates cached slot lookups
244
- clazz .setTpSlots (TpSlots .fromNative (clazz , context ));
245
249
return PNone .NO_VALUE ;
246
250
}
247
251
}
0 commit comments