https://github.com/python/cpython/commit/7dc2f52a6f58473b51f14b2f86f2527453fd16ff
commit: 7dc2f52a6f58473b51f14b2f86f2527453fd16ff
branch: main
author: Hood Chatham <[email protected]>
committer: vstinner <[email protected]>
date: 2026-03-23T21:57:23Z
summary:
gh-146197: Include a bit more information in sys._emscripten_info.runtime
(#146346)
files:
M Python/sysmodule.c
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 646b8a1c3c3a84..ce9c03bda7bd57 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -3878,20 +3878,38 @@ static PyStructSequence_Desc emscripten_info_desc = {
EM_JS(char *, _Py_emscripten_runtime, (void), {
var info;
- if (typeof navigator == 'object') {
+ if (typeof process === "object") {
+ if (process.versions?.bun) {
+ info = `bun v${process.versions.bun}`;
+ } else if (process.versions?.deno) {
+ info = `deno v${process.versions.deno}`;
+ } else {
+ // As far as I can tell, every JavaScript runtime puts "node" in
+ // process.release.name. Pyodide once checked for
+ //
+ // process.release.name === "node"
+ //
+ // and this is apparently part of the reason other runtimes started
+ // lying about it. Similar to the situation with userAgent.
+ //
+ // But just in case some other JS runtime decides to tell us what
it
+ // is, we'll pick it up.
+ const name = process.release?.name ?? "node";
+ info = `${name} ${process.version}`;
+ }
+ // Include v8 version if we know it
+ if (process.versions?.v8) {
+ info += ` (v8 ${process.versions.v8})`;
+ }
+ } else if (typeof navigator === "object") {
info = navigator.userAgent;
- } else if (typeof process == 'object') {
- info = "Node.js ".concat(process.version);
} else {
info = "UNKNOWN";
}
- var len = lengthBytesUTF8(info) + 1;
- var res = _malloc(len);
- if (res) stringToUTF8(info, res, len);
#if __wasm64__
- return BigInt(res);
+ return BigInt(stringToNewUTF8(info));
#else
- return res;
+ return stringToNewUTF8(info);
#endif
});
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]