From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:Marshal (Python)" |
|---|
| claim | "Marshalled code objects ('c') have version-specific fields. 2.x: argcount, nlocals, stacksize, flags, code, consts, names, varnames, freevars, cellvars, filename, name, firstlineno, lnotab. 3.0-3.7 add kwonlyargcount after argcount. 3.8-3.10 add posonlyargcount after argcount (3.10 calls the last field linetable). 3.11+: argcount, posonlyargcount, kwonlyargcount, stacksize, flags, code, consts, names, localsplusnames, localspluskinds, filename, name, qualname, firstlineno, linetable, exceptiontable. Counts and flags are int32, the rest marshal objects." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Marshal (Python)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | effect | "field order of TYPE_CODE" |
|---|
| condition | "choose by the Python version of the writer, not by the marshal format version" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "main TYPE_CODE reader (same order on the 3.15 branch and in v3.11.0 at lines 1347-1419)" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "010bebbf9fd12bba1e3f40bdbddacd51a9c2bf20" |
|---|
| path | "Python/marshal.c" |
|---|
| lines | "1818-1897" |
|---|
|
| type | "source" |
|---|
| detail | "v3.10.0 TYPE_CODE (posonlyargcount, nlocals, varnames/freevars/cellvars, linetable)" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "b494f5935c92951e75597bfe1c8b1f3112fec270" |
|---|
| path | "Python/marshal.c" |
|---|
| lines | "1302-1374" |
|---|
|
| type | "source" |
|---|
| detail | "v3.8.0 TYPE_CODE" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "fa919fdf2583bdfead1df00e842f24f30b2a34bf" |
|---|
| path | "Python/marshal.c" |
|---|
| lines | "1323-1395" |
|---|
|
| type | "source" |
|---|
| detail | "v3.7.0 TYPE_CODE (kwonlyargcount, no posonlyargcount)" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "1bf9cc509326bc42cd8cb1650eb9bf64550d817e" |
|---|
| path | "Python/marshal.c" |
|---|
| lines | "1358-1425" |
|---|
|
| type | "source" |
|---|
| detail | "v2.7.18 TYPE_CODE" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "8d21aa21f2cbc6d50aab3f420bb23be1d081dac4" |
|---|
| path | "Python/marshal.c" |
|---|
| lines | "996-1052" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "3.11+ order verified by decoding every stdlib pyc of 3.11.15 and 3.12.8 and comparing with marshal.loads; the older orders are read from source only" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Code object field order by version" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T05:12:30.010Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:52:27.828Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read TYPE_CODE reader in cpython marshal.c at 010bebbf (lines 1818-1897): order and int/object split match the 3.11+ list; older orders not re-read." |
|---|
|
|
|---|