Skip to content

Commit 9704150

Browse files
timfelabdelberni
authored andcommitted
Add an _nt core module for Windows-specific startup code. Fixes #493
(cherry picked from commit 2177ebd) fix conflicts for Add an _nt core module for Windows-specific startup code
1 parent 2b1ceb2 commit 9704150

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

graalpython/com.oracle.graal.python.frozen/freeze_modules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def add_graalpython_core():
119119
"java",
120120
"pip_hook",
121121
"unicodedata",
122+
"_nt",
122123
]:
123124
modname = f"graalpy.{os.path.basename(name)}"
124125
modpath = os.path.join(lib_graalpython, f"{name}.py")

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,11 @@ private static TruffleString[] initializeCoreFiles() {
423423
toTruffleStringUncached("_sysconfig"),
424424
toTruffleStringUncached("java"),
425425
toTruffleStringUncached("pip_hook")));
426+
if (PythonOS.getPythonOS() == PythonOS.PLATFORM_WIN32) {
427+
coreFiles = new ArrayList<>(coreFiles);
428+
coreFiles.add(toTruffleStringUncached("_nt"));
429+
}
430+
426431
// add service loader defined python file extensions
427432
if (!ImageInfo.inImageRuntimeCode()) {
428433
ServiceLoader<PythonBuiltins> providers = ServiceLoader.load(PythonBuiltins.class, Python3Core.class.getClassLoader());

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/module/FrozenModules.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ private static final class Map {
227227
private static final PythonFrozenModule GRAALPY_JAVA = new PythonFrozenModule("GRAALPY_JAVA", null, false);
228228
private static final PythonFrozenModule GRAALPY_PIP_HOOK = new PythonFrozenModule("GRAALPY_PIP_HOOK", null, false);
229229
private static final PythonFrozenModule GRAALPY_UNICODEDATA = new PythonFrozenModule("GRAALPY_UNICODEDATA", null, false);
230+
private static final PythonFrozenModule GRAALPY__NT = new PythonFrozenModule("GRAALPY__NT", null, false);
230231
}
231232

232233
public static final PythonFrozenModule lookup(String name) {
@@ -613,6 +614,8 @@ public static final PythonFrozenModule lookup(String name) {
613614
return Map.GRAALPY_PIP_HOOK;
614615
case "graalpy.unicodedata":
615616
return Map.GRAALPY_UNICODEDATA;
617+
case "graalpy._nt":
618+
return Map.GRAALPY__NT;
616619
default:
617620
return null;
618621
}

0 commit comments

Comments
 (0)