Skip to content

Commit 7d31f37

Browse files
committed
static load ok
1 parent 64f511b commit 7d31f37

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

support/__EMSCRIPTEN__.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ self hosting:
6060

6161
#include <unistd.h>
6262

63-
extern void Inittab_pygame();
63+
extern void pygame_Inittab();
6464
//extern PyMODINIT_FUNC PyInit_pygame_static(void);
6565

6666
static long long embed = 0;
@@ -466,8 +466,7 @@ main(int argc, char **argv)
466466
#endif
467467

468468
PyImport_AppendInittab("embed", init_embed);
469-
//PyImport_AppendInittab("pygame_static", PyInit_pygame_static);
470-
Inittab_pygame();
469+
pygame_Inittab();
471470

472471
setenv("TERM","xterm", 1);
473472
setenv("TERMINFO", "/usr/share/terminfo", 1);

support/__EMSCRIPTEN__.overlay/pygame/__init__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ def warn(self):
8383

8484
# this is a special loader for WebAssembly platform
8585
# where pygame is actually statically linked
86-
86+
# mixing single phase (C) and multiphase modules (cython)
8787
if sys.platform in ("wasi", "emscripten"):
8888
import pygame_static
8989

90-
pygame_static.load_into(sys.modules)
91-
9290
pygame = sys.modules[__name__]
9391

9492
pygame.Color = pygame.color.Color
@@ -107,13 +105,9 @@ def warn(self):
107105
import importlib.machinery
108106

109107
loader = importlib.machinery.FrozenImporter
110-
for alias in ("sdl2", "audio", "video", "controller", "mixer"):
108+
spec = importlib.machinery.ModuleSpec("", loader)
109+
pygame_static.import_cython(spec)
111110

112-
spec = importlib.machinery.ModuleSpec(alias, loader)
113-
try:
114-
pygame_static.load_sdl2(sys.modules, spec, alias)
115-
except:
116-
vars(pygame._sdl2)[alias] = MissingModule(alias, urgent=1)
117111

118112
# we need to import like this, each at a time. the cleanest way to import
119113
# our modules is with the import command (not the __import__ function)

0 commit comments

Comments
 (0)