|
43 | 43 | import com.oracle.graal.python.builtins.objects.object.ObjectBuiltinsFactory;
|
44 | 44 | import com.oracle.graal.python.builtins.objects.object.PythonObject;
|
45 | 45 | import com.oracle.graal.python.builtins.objects.str.StringUtils.SimpleTruffleStringFormatNode;
|
| 46 | +import com.oracle.graal.python.nodes.ErrorMessages; |
| 47 | +import com.oracle.graal.python.nodes.PRaiseNode; |
46 | 48 | import com.oracle.graal.python.nodes.PRootNode;
|
47 | 49 | import com.oracle.graal.python.nodes.frame.MaterializeFrameNode;
|
48 | 50 | import com.oracle.graal.python.nodes.frame.ReadCallerFrameNode;
|
|
51 | 53 | import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
|
52 | 54 | import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
|
53 | 55 | import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
|
| 56 | +import com.oracle.graal.python.nodes.util.CannotCastException; |
| 57 | +import com.oracle.graal.python.nodes.util.CastToJavaBooleanNode; |
54 | 58 | import com.oracle.truffle.api.CompilerDirectives;
|
55 | 59 | import com.oracle.truffle.api.RootCallTarget;
|
56 | 60 | import com.oracle.truffle.api.dsl.Cached;
|
@@ -179,11 +183,14 @@ static boolean doGet(PFrame self, @SuppressWarnings("unused") PNone v) {
|
179 | 183 | }
|
180 | 184 |
|
181 | 185 | @Specialization(guards = "!isNoValue(v)")
|
182 |
| - static Object doSet(PFrame self, boolean v) { |
183 |
| - self.setTraceLine(v); |
| 186 | + static Object doSet(PFrame self, Object v, @Cached PRaiseNode raise, @Cached CastToJavaBooleanNode cast) { |
| 187 | + try { |
| 188 | + self.setTraceLine(cast.execute(v)); |
| 189 | + } catch (CannotCastException e) { |
| 190 | + throw raise.raise(PythonBuiltinClassType.TypeError, ErrorMessages.ATTRIBUTE_VALUE_MUST_BE_BOOL); |
| 191 | + } |
184 | 192 | return PNone.NONE;
|
185 | 193 | }
|
186 |
| - |
187 | 194 | }
|
188 | 195 |
|
189 | 196 | @Builtin(name = "f_code", minNumOfPositionalArgs = 1, isGetter = true)
|
|
0 commit comments