|
65 | 65 | import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
|
66 | 66 | import com.oracle.graal.python.builtins.objects.function.PKeyword;
|
67 | 67 | import com.oracle.graal.python.builtins.objects.object.ObjectBuiltinsFactory.GetAttributeNodeFactory;
|
| 68 | +import com.oracle.graal.python.builtins.objects.str.StringNodes; |
68 | 69 | import com.oracle.graal.python.builtins.objects.type.PythonAbstractClass;
|
69 | 70 | import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass;
|
70 | 71 | import com.oracle.graal.python.builtins.objects.type.TypeNodes;
|
@@ -430,13 +431,15 @@ public static GetAttributeNode create() {
|
430 | 431 | @GenerateNodeFactory
|
431 | 432 | public abstract static class SetattrNode extends PythonTernaryBuiltinNode {
|
432 | 433 | @Specialization(limit = "3")
|
433 |
| - protected PNone doIt(VirtualFrame frame, Object object, Object key, Object value, |
| 434 | + protected PNone doIt(VirtualFrame frame, Object object, Object keyObject, Object value, |
434 | 435 | @CachedLibrary("object") PythonObjectLibrary libObj,
|
| 436 | + @Cached StringNodes.CastToJavaStringCheckedNode castToString, |
435 | 437 | @Cached("create()") LookupAttributeInMRONode.Dynamic getExisting,
|
436 | 438 | @Cached("create()") GetClassNode getDataClassNode,
|
437 | 439 | @Cached("create(__SET__)") LookupAttributeInMRONode lookupSetNode,
|
438 | 440 | @Cached("create()") CallTernaryMethodNode callSetNode,
|
439 | 441 | @Cached("create()") WriteAttributeToObjectNode writeNode) {
|
| 442 | + String key = castToString.cast(keyObject, "attribute name must be string, not '%p'", keyObject); |
440 | 443 | Object type = libObj.getLazyPythonClass(object);
|
441 | 444 | Object descr = getExisting.execute(type, key);
|
442 | 445 | if (descr != PNone.NO_VALUE) {
|
|
0 commit comments