Skip to content

Commit dc282dc

Browse files
committed
Move CAPI_LOAD_ERROR to ErrorMessages.
1 parent 54305b9 commit dc282dc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ private Object loadDynamicModuleWithSpec(String name, String path, InteropLibrar
266266
}
267267
}
268268

269-
private static final String CAPI_LOAD_ERROR = "Could not load C API from %s.\n";
270-
271269
@TruffleBoundary
272270
private void ensureCapiWasLoaded() {
273271
PythonContext context = getContext();
@@ -286,10 +284,10 @@ private void ensureCapiWasLoaded() {
286284
}
287285
capi = context.getEnv().parseInternal(capiSrcBuilder.build()).call();
288286
} catch (IOException | RuntimeException e) {
289-
LOGGER.severe(() -> String.format(CAPI_LOAD_ERROR, capiFile.getAbsoluteFile().getPath()));
287+
LOGGER.severe(() -> String.format(ErrorMessages.CAPI_LOAD_ERROR, capiFile.getAbsoluteFile().getPath()));
290288
LOGGER.severe(() -> "Original error was: " + e);
291289
e.printStackTrace();
292-
throw raise(PythonErrorType.ImportError, CAPI_LOAD_ERROR, capiFile.getAbsoluteFile().getPath());
290+
throw raise(PythonErrorType.ImportError, ErrorMessages.CAPI_LOAD_ERROR, capiFile.getAbsoluteFile().getPath());
293291
}
294292
// call into Python to initialize python_cext module globals
295293
ReadAttributeFromObjectNode readNode = ReadAttributeFromObjectNode.getUncached();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,5 @@ public abstract class ErrorMessages {
522522
public static final String CANNOT_ENCODE_DOCSTR = "'utf-8' codec can't encode docstring '%s'";
523523
public static final String PRECISION_NOT_ALLOWED_FOR_INT = "Precision not allowed in integer format specifier";
524524
public static final String SIGN_NOT_ALLOWED_WITH_C_FOR_INT = "Sign not allowed with integer format specifier 'c'";
525+
public static final String CAPI_LOAD_ERROR = "Could not load C API from %s.";
525526
}

0 commit comments

Comments
 (0)