Skip to content

Commit 4751a7b

Browse files
committed
an invalid home/lib path is always fatal
1 parent 6aabdb2 commit 4751a7b

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/Python3Core.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
import java.io.IOException;
3636
import java.net.MalformedURLException;
37-
import java.net.URI;
3837
import java.net.URL;
3938
import java.util.Arrays;
4039
import java.util.HashMap;
@@ -781,8 +780,7 @@ private static Source getSource(String basename, String prefix) {
781780
try {
782781
return env.newSourceBuilder(file).name(basename).mimeType(PythonLanguage.MIME_TYPE).build();
783782
} catch (SecurityException | IOException t) {
784-
// TODO: XXX: This will only work if we already have cached parse trees
785-
return Source.newBuilder("").uri(URI.create(file.getPath())).name(basename).mimeType(PythonLanguage.MIME_TYPE).build();
783+
throw new RuntimeException("Could not read core library from " + file);
786784
}
787785
}
788786
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonCore.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
4040
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
4141
import com.oracle.truffle.api.TruffleLanguage;
42-
import com.oracle.truffle.api.TruffleOptions;
4342
import com.oracle.truffle.api.nodes.Node;
4443
import com.oracle.truffle.api.source.Source;
4544

@@ -57,7 +56,6 @@ public interface PythonCore {
5756
static final String NO_CORE_WARNING = "could not determine Graal.Python's core path - you may need to pass --python.CoreHome.";
5857
static final String NO_STDLIB = "could not determine Graal.Python's standard library path. You need to pass --python.StdLibHome if you want to use the standard library.";
5958
static final boolean LIBPOLYGLOT = Boolean.getBoolean("graalvm.libpolyglot");
60-
static final boolean AOT = TruffleOptions.AOT;
6159

6260
/**
6361
* Set up the basic types and classes in Java.
@@ -153,13 +151,7 @@ public static String getCoreHomeOrFail() {
153151
TruffleLanguage.Env env = PythonLanguage.getContext().getEnv();
154152
String coreHome = env.getOptions().get(PythonOptions.CoreHome);
155153
if (coreHome.isEmpty()) {
156-
if (!AOT) {
157-
throw new RuntimeException(NO_CORE_FATAL);
158-
} else {
159-
writeWarning(env, NO_CORE_WARNING);
160-
}
161-
env.getOptions().set(PythonOptions.CoreHome, LIB_GRAALPYTHON);
162-
return LIB_GRAALPYTHON;
154+
throw new RuntimeException(NO_CORE_FATAL);
163155
}
164156
return coreHome;
165157
}

0 commit comments

Comments
 (0)