From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "identification" |
|---|
| subject | "Format:PYC (Python compiled bytecode)" |
|---|
| claim | "The first 4 bytes of a pyc name the CPython version: 03 F3 0D 0A = 2.7, 3B 0C 0D 0A = 3.0, 4F 0C 0D 0A = 3.1, 6C 0C 0D 0A = 3.2, 9E 0C 0D 0A = 3.3, EE 0C 0D 0A = 3.4, 16 0D 0D 0A = 3.5, 17 0D 0D 0A = 3.5.2+, 33 0D 0D 0A = 3.6, 42 0D 0D 0A = 3.7, 55 0D 0D 0A = 3.8, 61 0D 0D 0A = 3.9, 6F 0D 0D 0A = 3.10, A7 0D 0D 0A = 3.11, CB 0D 0D 0A = 3.12, F3 0D 0D 0A = 3.13, 2B 0E 0D 0A = 3.14, 52 0E 0D 0A = 3.15 (final releases; pre-releases use nearby values)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:PYC (Python compiled bytecode)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | method | "compare the first 4 bytes with the final-release magic numbers (uint16 LE + 0D 0A)" |
|---|
| indicator | "03 F3 0D 0A | 3B 0C 0D 0A | 4F 0C 0D 0A | 6C 0C 0D 0A | 9E 0C 0D 0A | EE 0C 0D 0A | 16 0D 0D 0A | 17 0D 0D 0A | 33 0D 0D 0A | 42 0D 0D 0A | 55 0D 0D 0A | 61 0D 0D 0A | 6F 0D 0D 0A | A7 0D 0D 0A | CB 0D 0D 0A | F3 0D 0D 0A | 2B 0E 0D 0A | 52 0E 0D 0A" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "the byte strings are the release magic numbers of the enum fact on this page, packed as PYC_MAGIC_NUMBER_TOKEN (lines 316-320)" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "010bebbf9fd12bba1e3f40bdbddacd51a9c2bf20" |
|---|
| path | "Include/internal/pycore_magic_number.h" |
|---|
| lines | "28-299" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "A7 0D 0D 0A and CB 0D 0D 0A are what CPython 3.11.15 and 3.12.8 write; the other values are computed from the source table" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | | "Fact:PYC (Python compiled bytecode)/enum/Magic numbers of final releases" |
|
|---|
| key | "Magic bytes of each Python release" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T05:18:32.702Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T02:38:47.861Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read final-tag magic numbers: 3.0 and 3.1 import.c MAGIC 3130/3150 plus the unconditional pyc_magic = MAGIC + 1 (3131/3151), 3.2 3180, 3.3 3230, 3.4 3310, 3.5.0 3350, 3.5.3 3351, 3.6 3379, 3.7 3394, 3.8 3413, 3.9 3425, 3.10 3439, 3.11 3495, 3.12 3531, 3.13 3571, 3.14.0 3627, 3.15.0 3666; all match the little-endian bytes in the table." |
|---|
|
|
|---|