Skip to content

Commit 516ddcb

Browse files
author
Adam Hrbac
committed
Move error message and use better names
1 parent 2e75028 commit 516ddcb

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@
242242
public class SysModuleBuiltins extends PythonBuiltins {
243243
private static final TruffleString T_LICENSE = tsLiteral(
244244
"Copyright (c) Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.");
245-
private static final TruffleString T_SETTRACE_NOT_IMPLEMENTED = tsLiteral("sys.settrace is only implemented for the bytecode interpreter.");
246245
private static final String COMPILE_TIME;
247246
public static final PNone FRAMEWORK = PNone.NONE;
248247
public static final int MAXSIZE = Integer.MAX_VALUE;
@@ -977,7 +976,7 @@ abstract static class SetTrace extends PythonBuiltinNode {
977976
Object settrace(Object function) {
978977
PythonContext ctx = getContext();
979978
if (!ctx.getOption(PythonOptions.EnableBytecodeInterpreter)) {
980-
throw raise(NotImplementedError, T_SETTRACE_NOT_IMPLEMENTED);
979+
throw raise(NotImplementedError, ErrorMessages.SETTRACE_NOT_IMPLEMENTED);
981980
}
982981
PythonContext.PythonThreadState state = ctx.getThreadState(getLanguage());
983982
if (function == PNone.NONE) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/frame/FrameBuiltins.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ int get(PFrame self) {
158158
@GenerateNodeFactory
159159
public abstract static class GetTraceNode extends PythonBuiltinNode {
160160
@Specialization(guards = "isNoValue(v)")
161-
static Object doit(PFrame self, @SuppressWarnings("unused") PNone v) {
161+
static Object doGet(PFrame self, @SuppressWarnings("unused") PNone v) {
162162
Object traceFun = self.getLocalTraceFun();
163163
return traceFun == null ? PNone.NONE : traceFun;
164164
}
165165

166166
@Specialization(guards = "!isNoValue(v)")
167-
static Object doit(PFrame self, Object v) {
167+
static Object doSet(PFrame self, Object v) {
168168
self.setLocalTraceFun(v == PNone.NONE ? null : v);
169169
return PNone.NONE;
170170
}
@@ -174,12 +174,12 @@ static Object doit(PFrame self, Object v) {
174174
@GenerateNodeFactory
175175
public abstract static class TraceLinesNode extends PythonBuiltinNode {
176176
@Specialization(guards = "isNoValue(v)")
177-
static boolean doit(PFrame self, @SuppressWarnings("unused") PNone v) {
177+
static boolean doGet(PFrame self, @SuppressWarnings("unused") PNone v) {
178178
return self.getTraceLine();
179179
}
180180

181181
@Specialization(guards = "!isNoValue(v)")
182-
static Object doit(PFrame self, boolean v) {
182+
static Object doSet(PFrame self, boolean v) {
183183
self.setTraceLine(v);
184184
return PNone.NONE;
185185
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/ErrorMessages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,4 +1448,6 @@ public abstract class ErrorMessages {
14481448
public static final TruffleString MSG_NOT_SET = tsLiteral("<message not set>");
14491449

14501450
public static final TruffleString HPY_DEBUG_MODE_NOT_AVAILABLE = tsLiteral("HPy debug mode is not available");
1451+
1452+
public static final TruffleString SETTRACE_NOT_IMPLEMENTED = tsLiteral("sys.settrace is only implemented for the bytecode interpreter.");
14511453
}

0 commit comments

Comments
 (0)