Skip to content

Commit 249631a

Browse files
committed
Add PRaiseNode#raiseExceptionObject and rename PRaiseNode.raiseExceptionObject to raiseExceptionObjectStatic
* Fixes javac warnings about calling a static method on an instane.
1 parent 762a6a4 commit 249631a

File tree

13 files changed

+39
-35
lines changed

13 files changed

+39
-35
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static void handle(Node inliningTarget, TruffleEncoder encoder, TruffleString er
250250
int end = start + encoder.getErrorLength();
251251
Object exception = lazyCallNode.executeWithoutFrame(UnicodeEncodeError, encoder.getEncodingName(), inputObject, start, end, encoder.getErrorReason());
252252
if (exception instanceof PBaseException) {
253-
throw raiseNode.raiseExceptionObject(inliningTarget, (PBaseException) exception);
253+
throw raiseNode.raiseExceptionObject(inliningTarget, exception);
254254
} else {
255255
// Shouldn't happen unless the user manually replaces the method, which is
256256
// really

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private RuntimeException handleCompilationError(Node node, RuntimeException e, I
423423
PythonModule module = context.lookupBuiltinModule(BuiltinNames.T__SRE);
424424
Object errorConstructor = PyObjectLookupAttr.executeUncached(module, T_ERROR);
425425
PBaseException exception = (PBaseException) CallNode.executeUncached(errorConstructor, reason, originalPattern, position);
426-
return PRaiseNode.raiseExceptionObject(node, exception);
426+
return PRaiseNode.raiseExceptionObjectStatic(node, exception);
427427
}
428428
}
429429
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ private void warnExplicitPart2(PythonContext context, PythonModule warnings, Tru
834834
if (!PyExceptionInstanceCheckNode.executeUncached(message)) {
835835
throw PRaiseNode.raiseStatic(this, PythonBuiltinClassType.SystemError, ErrorMessages.EXCEPTION_NOT_BASEEXCEPTION, PyObjectReprAsTruffleStringNode.executeUncached(message));
836836
} else {
837-
throw PRaiseNode.raiseExceptionObject(this, message);
837+
throw PRaiseNode.raiseExceptionObjectStatic(this, message);
838838
}
839839
}
840840

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextErrBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static Object create(Object type, Object value,
209209
@SuppressWarnings("unused") @Shared @Cached IsSubClassNode isSubClassNode,
210210
@Cached PrepareExceptionNode prepareExceptionNode) {
211211
Object exception = prepareExceptionNode.execute(null, type, value);
212-
throw PRaiseNode.raiseExceptionObject(inliningTarget, exception);
212+
throw PRaiseNode.raiseExceptionObjectStatic(inliningTarget, exception);
213213
}
214214

215215
protected static boolean isExceptionClass(Node inliningTarget, Object obj, IsTypeNode isTypeNode, IsSubClassNode isSubClassNode) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextPyStateBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ int doIt(long id, Object exceptionObject) {
182182
@Override
183183
protected void perform(Access access) {
184184
if (missedCount == MAX_MISSED_COUNT) {
185-
throw PRaiseNode.raiseExceptionObject(null, exceptionObject);
185+
throw PRaiseNode.raiseExceptionObjectStatic(null, exceptionObject);
186186
}
187187
// If possible, we do not want to raise in some internal code, it could
188188
// corrupt internal data structures.
189189
Node location = access.getLocation();
190190
if (location != null) {
191191
RootNode rootNode = location.getRootNode();
192192
if (rootNode instanceof PRootNode && !rootNode.isInternal()) {
193-
throw PRaiseNode.raiseExceptionObject(null, exceptionObject);
193+
throw PRaiseNode.raiseExceptionObjectStatic(null, exceptionObject);
194194
}
195195
}
196196
// Heuristic fabricated out of thin air:

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/codecs/ErrorHandlers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ abstract static class StrictErrorHandlerNode extends ErrorHandlerBaseNode {
269269
@Specialization
270270
static Object doException(PBaseException exception,
271271
@Bind Node inliningTarget) {
272-
throw PRaiseNode.raiseExceptionObject(inliningTarget, exception);
272+
throw PRaiseNode.raiseExceptionObjectStatic(inliningTarget, exception);
273273
}
274274

275275
@Fallback
@@ -985,7 +985,7 @@ abstract static class RaiseEncodeException extends Node {
985985
static void doIt(VirtualFrame frame, Node inliningTarget, ErrorHandlerCache cache, TruffleString encoding, TruffleString srcObj, int startPos, int endPos, TruffleString reason,
986986
@Cached MakeEncodeExceptionNode makeEncodeExceptionNode) {
987987
cache.exceptionObject = makeEncodeExceptionNode.execute(frame, inliningTarget, cache.exceptionObject, encoding, srcObj, startPos, endPos, reason);
988-
PRaiseNode.raiseExceptionObject(inliningTarget, cache.exceptionObject);
988+
PRaiseNode.raiseExceptionObjectStatic(inliningTarget, cache.exceptionObject);
989989
}
990990
}
991991

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/AbstractBufferedIOBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static PException raise(Node node, Object errno, TruffleString message, int writ
231231
attrs[OsErrorBuiltins.IDX_STRERROR] = message;
232232
attrs[OsErrorBuiltins.IDX_WRITTEN] = written;
233233
exception.setExceptionAttributes(attrs);
234-
return PRaiseNode.raiseExceptionObject(node, exception);
234+
return PRaiseNode.raiseExceptionObjectStatic(node, exception);
235235
}
236236
}
237237

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/json/JSONScannerBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,12 @@ private static RuntimeException decodeError(Node raisingNode, String jsonString,
549549
Object module = AbstractImportNode.importModule(toTruffleStringUncached("json.decoder"));
550550
Object errorClass = PyObjectLookupAttr.executeUncached(module, T_JSON_DECODE_ERROR);
551551
Object exception = CallNode.executeUncached(errorClass, format, toTruffleStringUncached(jsonString), pos);
552-
throw PRaiseNode.raiseExceptionObject(raisingNode, exception, false);
552+
throw PRaiseNode.raiseExceptionObjectStatic(raisingNode, exception, false);
553553
}
554554

555555
private static RuntimeException stopIteration(Node raisingNode, Object value) {
556556
CompilerAsserts.neverPartOfCompilation();
557557
Object exception = CallNode.executeUncached(PythonContext.get(raisingNode).lookupType(PythonBuiltinClassType.StopIteration), value);
558-
throw PRaiseNode.raiseExceptionObject(raisingNode, exception, false);
558+
throw PRaiseNode.raiseExceptionObjectStatic(raisingNode, exception, false);
559559
}
560560
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtCommonNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ private static PException raiseResultWithError(Node node, TruffleString name, Ob
614614
PythonLanguage language = PythonLanguage.get(null);
615615
PBaseException sysExc = PFactory.createBaseException(language, SystemError, resultWithErrorMessage, new Object[]{name});
616616
sysExc.setCause(currentException);
617-
throw PRaiseNode.raiseExceptionObject(node, sysExc, PythonOptions.isPExceptionWithJavaStacktrace(language));
617+
throw PRaiseNode.raiseExceptionObjectStatic(node, sysExc, PythonOptions.isPExceptionWithJavaStacktrace(language));
618618
}
619619
}
620620

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/exception/PBaseException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ RuntimeException throwException(
302302
@Shared("gil") @Cached GilNode gil) {
303303
boolean mustRelease = gil.acquire();
304304
try {
305-
throw PRaiseNode.raiseExceptionObject(node, this);
305+
throw PRaiseNode.raiseExceptionObjectStatic(node, this);
306306
} finally {
307307
gil.release(mustRelease);
308308
}

0 commit comments

Comments
 (0)