We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
_Py_Version
1 parent 0fef47e commit e2064d6Copy full SHA for e2064d6
Tools/wasm/emscripten/web_example/python.worker.mjs
@@ -70,12 +70,9 @@ const emscriptenSettings = {
70
postMessage({ type: "ready", stdinBuffer: stdinBuffer.sab });
71
},
72
async preRun(Module) {
73
- const versionHex = Module.HEAPU32[Module._Py_Version / 4].toString(16);
74
- const versionTuple = versionHex
75
- .padStart(8, "0")
76
- .match(/.{1,2}/g)
77
- .map((x) => parseInt(x, 16));
78
- const [major, minor, ..._] = versionTuple;
+ const versionInt = Module.HEAPU32[Module._Py_Version >>> 2];
+ const major = (versionInt >>> 24) & 0xff;
+ const minor = (versionInt >>> 16) & 0xff;
79
// Prevent complaints about not finding exec-prefix by making a lib-dynload directory
80
Module.FS.mkdirTree(`/lib/python${major}.${minor}/lib-dynload/`);
81
Module.addRunDependency("install-stdlib");
0 commit comments