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

+4 -36
View File
@@ -40,16 +40,10 @@ const inlineCacheProfiles = (
* profile only where their source changes do not alter cache widths or IDs.
* Final 3.13 magic 3571 matches the opcode IDs and cache widths in CPython
* v3.13.17's Lib/_opcode_metadata.py and Lib/opcode.py.
* The 3.14 and 3.15 tables are pinned only to magics checked against real
* CPython: 3627 (final 3.14, matches v3.14.4) and 3663 (3.15.0a8) were read
* back from those builds; 3666 (final 3.15, matches v3.15.0) was checked with
* real 3.15.2 release bytes, not by running 3.15.2. Each is the generated
* _PyOpcode_Caches and opmap from CPython's Include/internal/pycore_magic_number.h
* history at the last cache-changing bump commit at or before it:
* 60202609a2c2d0971aadfa4729ba30b50e89c6ea (3623, shared by 3624 to 3627),
* 879c85f6e4ca8424ff6b4fddfbc946889572bf13 (3663) and
* 600f4dbd54bb35f56ecf1430134d2072b0520aa3 (3665, shared by 3666). Other 3.14
* and 3.15 pre-release magics have no table here and are not decoded.
* The 3.14 and 3.15 tables are pinned only to magics checked against a real
* interpreter: 3627 equals `opcode._inline_cache_entries` and `opcode.opmap`
* in CPython 3.14.6, and 3666 equals them in CPython 3.15.0b3. Other 3.14 and
* 3.15 pre-release magics have no table here and are not decoded.
*/
const INLINE_CACHE_ENTRIES_BY_MAGIC: ReadonlyMap<
number,
@@ -450,32 +444,6 @@ const INLINE_CACHE_ENTRIES_BY_MAGIC: ReadonlyMap<
[119, 1],
],
),
...inlineCacheProfiles(
[3663],
[
[4, 1],
[36, 1],
[37, 3],
[42, 5],
[50, 3],
[53, 3],
[54, 1],
[55, 1],
[68, 1],
[74, 1],
[79, 9],
[91, 4],
[95, 1],
[99, 1],
[100, 1],
[101, 1],
[102, 1],
[105, 1],
[109, 4],
[118, 1],
[128, 1],
],
),
...inlineCacheProfiles(
[3666],
[
+2 -2
View File
@@ -241,8 +241,8 @@ export const parsePythonPyc = (
}`;
return unsupported(
identity === null
? `Pyc magic ${magic} is not a pinned CPython identity, so its header cannot be qualified; standalone marshal decoding is pinned for CPython 3.7–3.13 and the 3.14 and 3.15 magics 3627, 3663 and 3666.`
: `CPython ${identity.pythonVersion} header is recognized (magic ${magic}, ${headerFacts}), but no marshal code layout is pinned for that version, so its code objects cannot be decoded. Standalone marshal decoding is pinned for CPython 3.7–3.13 and the 3.14 and 3.15 magics 3627, 3663 and 3666.`,
? `Pyc magic ${magic} is not a pinned CPython identity, so its header cannot be qualified; standalone marshal decoding is pinned for CPython 3.7–3.13 and the 3.14 and 3.15 magics 3627 and 3666.`
: `CPython ${identity.pythonVersion} header is recognized (magic ${magic}, ${headerFacts}), but no marshal code layout is pinned for that version, so its code objects cannot be decoded. Standalone marshal decoding is pinned for CPython 3.7–3.13 and the 3.14 and 3.15 magics 3627 and 3666.`,
);
}
const flags = bytes.readUInt32LE(4);