@@ -230,8 +230,8 @@ static boolean writeToDictClass(PythonClass klass, TruffleString key, Object val
230
230
return writeToDictManagedClass (klass , dict , key , value , inliningTarget , callAttrUpdate , updateStorage , setHashingStorageItem , codePointLengthNode , codePointAtIndexNode );
231
231
}
232
232
233
- @ Specialization (guards = {"dict != null" , "isNoValue(value)" })
234
- static boolean deleteFromDict (PythonObject obj , TruffleString key , Object value ,
233
+ @ Specialization (guards = {"dict != null" , "isNoValue(value)" , "!isPythonBuiltinClass(obj)" })
234
+ static boolean deleteFromPythonObject (PythonObject obj , TruffleString key , Object value ,
235
235
@ Bind ("this" ) Node inliningTarget ,
236
236
@ SuppressWarnings ("unused" ) @ Shared ("getDict" ) @ Cached GetDictIfExistsNode getDict ,
237
237
@ Bind ("getDict.execute(obj)" ) PDict dict ,
@@ -252,6 +252,14 @@ static boolean deleteFromDict(PythonObject obj, TruffleString key, Object value,
252
252
}
253
253
}
254
254
255
+ @ Specialization (guards = {"dict != null" , "isNoValue(value)" })
256
+ static boolean deleteFromPythonBuiltinClass (PythonBuiltinClass klass , TruffleString key , Object value ,
257
+ @ Bind ("this" ) Node inliningTarget ,
258
+ @ SuppressWarnings ("unused" ) @ Shared ("getDict" ) @ Cached GetDictIfExistsNode getDict ,
259
+ @ Bind ("getDict.execute(klass)" ) PDict dict ) {
260
+ throw PRaiseNode .raiseStatic (inliningTarget , TypeError , ErrorMessages .CANT_SET_ATTRIBUTE_R_OF_IMMUTABLE_TYPE_N , key , klass );
261
+ }
262
+
255
263
private static boolean writeToDictManagedClass (PythonManagedClass klass , PDict dict , TruffleString key , Object value , Node inliningTarget ,
256
264
InlinedBranchProfile callAttrUpdate , InlinedBranchProfile updateStorage , HashingStorageSetItem setHashingStorageItem , TruffleString .CodePointLengthNode codePointLengthNode ,
257
265
TruffleString .CodePointAtIndexNode codePointAtIndexNode ) {
0 commit comments