fix(python): honor version-specific code equality

Fixes #6547
This commit is contained in:
morluto
2026-10-23 17:00:24 +08:00
parent 012959e3cc
commit 60981e0801
3 changed files with 124 additions and 2 deletions
+6 -2
View File
@@ -1156,8 +1156,12 @@ class MarshalReader {
`${node.bytecode.bytes}:${node.bytecode.sha256}`,
this.#constKeyItems(material.consts),
...nameTables,
material.linetable,
material.exceptiontable,
// CPython started including line and exception tables in code equality
// with the 3.11 code layout; earlier layouts still retain their digests
// in CodeEquality, but those fields do not affect container identity.
...(this.layout === "py311"
? [material.linetable, material.exceptiontable]
: []),
];
const key = this.#boundedJoin(
"",