refactor(python): share marshal string projection (#16385)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-03 14:52:32 +00:00
1 parent 62c27158c3
commit 51475a6341
2 files changed
+5 -9

No files matched your search

+5 -3
View File
@@ -22,7 +22,6 @@ import { PYTHON_PYC_FORMAT, pythonPycLimit } from "./PythonPyc.errors.js";
import { pythonPycBytecodeIdentity } from "./PythonPycBytecodeEquality.js";
import {
asBytes,
asString,
asStringWithRaw,
asTuple,
emptyPythonPycWork,
@@ -531,13 +530,16 @@ class PycMarshalReader extends MarshalReader<MarshalValue> {
varnames.display.length,
);
}
const filename = asString(this.readObject(depth + 1), "co_filename");
const filename = asStringWithRaw(
this.readObject(depth + 1),
"co_filename",
).value;
const nameObject = this.readObject(depth + 1);
const codeName = asStringWithRaw(nameObject, "co_name");
const name = codeName.value;
const qualname =
this.layout === "py311"
? asString(this.readObject(depth + 1), "co_qualname")
? asStringWithRaw(this.readObject(depth + 1), "co_qualname").value
: null;
const firstlineno = this.i32();
const linetable = asBytes(this.readObject(depth + 1), "co_linetable");