|
31 | 31 |
|
32 | 32 | import java.io.IOException;
|
33 | 33 | import java.math.BigInteger;
|
34 |
| -import java.net.MalformedURLException; |
35 |
| -import java.net.URL; |
36 | 34 | import java.util.ArrayList;
|
37 | 35 | import java.util.Arrays;
|
38 | 36 | import java.util.HashMap;
|
@@ -598,34 +596,19 @@ private void addBuiltinsTo(PythonObject obj, PythonBuiltins builtinsForObj) {
|
598 | 596 |
|
599 | 597 | @TruffleBoundary
|
600 | 598 | private Source getSource(String basename, String prefix) {
|
601 |
| - URL url = null; |
602 |
| - try { |
603 |
| - url = new URL(prefix); |
604 |
| - } catch (MalformedURLException e) { |
605 |
| - // pass |
606 |
| - } |
607 | 599 | String suffix = FILE_SEPARATOR + basename + ".py";
|
608 | 600 | PythonContext ctxt = getContext();
|
609 |
| - if (url != null) { |
610 |
| - // This path is hit when we load the core library e.g. from a Jar file |
611 |
| - try { |
612 |
| - return getLanguage().newSource(ctxt, new URL(url + suffix), basename); |
613 |
| - } catch (IOException e) { |
614 |
| - throw new RuntimeException("Could not read core library from " + url); |
615 |
| - } |
616 |
| - } else { |
617 |
| - Env env = ctxt.getEnv(); |
618 |
| - TruffleFile file = env.getTruffleFile(prefix + suffix); |
619 |
| - try { |
620 |
| - if (file.exists()) { |
621 |
| - return getLanguage().newSource(ctxt, file, basename); |
622 |
| - } |
623 |
| - } catch (SecurityException | IOException t) { |
624 |
| - // fall through; |
| 601 | + Env env = ctxt.getEnv(); |
| 602 | + TruffleFile file = env.getTruffleFile(prefix + suffix); |
| 603 | + try { |
| 604 | + if (file.exists()) { |
| 605 | + return getLanguage().newSource(ctxt, file, basename); |
625 | 606 | }
|
626 |
| - PythonLanguage.getLogger().log(Level.SEVERE, "Startup failed, could not read core library from " + file + ". Maybe you need to set python.CoreHome and python.StdLibHome."); |
627 |
| - throw new RuntimeException(); |
| 607 | + } catch (SecurityException | IOException t) { |
| 608 | + // fall through; |
628 | 609 | }
|
| 610 | + PythonLanguage.getLogger().log(Level.SEVERE, "Startup failed, could not read core library from " + file + ". Maybe you need to set python.CoreHome and python.StdLibHome."); |
| 611 | + throw new RuntimeException(); |
629 | 612 | }
|
630 | 613 |
|
631 | 614 | private void loadFile(String s, String prefix) {
|
|
0 commit comments