fix(python): pin only the 3.14 and 3.15 magics checked locally

Keep magic 3627 (CPython 3.14.6) and 3666 (CPython 3.15.0b3), whose code
layout and inline-cache tables match those interpreters' opcode tables and
whose decoded code objects match marshal.loads across a stdlib sample. Leave
the 3.15.0a8 magic 3663 unpinned, since no 3.15.0a8 interpreter was available
to check it, and regenerate the 3.15 slice fixture with 3.15.0b3.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
gensokyo-devandgensokyo-dev authored and Ysopwnable committed 2026-11-14 13:37:55 +01:00
1 parent 1d08253ff2
commit 9d3eb083dd
7 files changed
+108 -148

No files matched your search

+1 -2
View File
@@ -27,8 +27,7 @@ const PYTHON_BYTECODE_IDENTITIES: ReadonlyMap<number, PythonBytecodeIdentity> =
...identities(range(3550, 3571), "3.13"),
...identities([3627], "3.14"),
// Reported against Python 3.15, the default `python3` on current Homebrew.
// 3663 is the 3.15.0a8 magic, read back from a real interpreter.
...identities([3663, 3666], "3.15"),
...identities([3666], "3.15"),
]);
export const pythonBytecodeIdentity = (
+1 -6
View File
@@ -88,15 +88,10 @@ it("keeps pinned CPython identity separate from standalone marshal coverage", ()
pythonVersion: "3.15",
headerBytes: 16,
});
expect(pythonBytecodeIdentity(3663)).toEqual({
pythonVersion: "3.15",
headerBytes: 16,
});
expect(pythonPycMarshalProfile(3663)?.code_layout).toBe("py311");
expect(pythonPycMarshalProfile(3666)?.code_layout).toBe("py311");
// Only magics checked against real CPython are pinned: the neighbouring
// 3.14 and 3.15 pre-release magics and the 3.16 magics stay unknown.
for (const magic of [3600, 3626, 3650, 3662, 3664, 3665, 3706]) {
for (const magic of [3600, 3626, 3650, 3662, 3663, 3664, 3665, 3706]) {
expect(pythonBytecodeIdentity(magic), String(magic)).toBeNull();
expect(pythonPycMarshalProfile(magic), String(magic)).toBeNull();
}
+3 -5
View File
@@ -63,11 +63,9 @@ export const PYTHON_PYC_MARSHAL_PROFILES: ReadonlyMap<
...consecutiveProfiles(3550, 3571, "py311"),
// 3.14 and 3.15 keep the 3.11 code layout; 3.14a1 magic 3608 adds slice
// constants to marshal, which the reader gates by magic. Only magics checked
// against real CPython are pinned: 3627 (3.14.4) and 3663 (3.15.0a8) were
// read back from those interpreters; 3666 (3.15.2) was checked with real
// 3.15.2 release bytes decoded by the 3.15.0a8 interpreter. Other
// pre-release magics stay unpinned.
...profiles([3627, 3663, 3666], "py311"),
// against a real interpreter are pinned: 3627 (CPython 3.14.6) and 3666
// (CPython 3.15.0b3). Other pre-release magics stay unpinned.
...profiles([3627, 3666], "py311"),
]);
export const pythonPycMarshalProfile = (