From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:PyInstaller archive (CArchive and PYZ)" |
|---|
| claim | "A PYZ archive starts with 'PYZ\0', then the 4-byte Python bytecode magic number of the building interpreter, then a big-endian int32 TOC offset and 4 unused bytes (17-byte reserved header in the writer); the TOC at that offset is a marshal list of (name, (type, offset, length)) and each module is zlib(marshal(code object)) without pyc header." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:PyInstaller archive (CArchive and PYZ)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "PYZ_HEADER" |
|---|
| size_min | 12 |
|---|
| fields | | name | "magic" |
|---|
| offset | 0 |
|---|
| type | "char[4]" |
|---|
|
| name | "pyc_magic" |
|---|
| offset | 4 |
|---|
| type | "char[4]" |
|---|
|
| name | "toc_offset" |
|---|
| offset | 8 |
|---|
| type | "int32 BE" |
|---|
|
|
|---|
| endianness | "big" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "ZlibArchiveWriter: header placeholder, marshal.dumps(toc), zlib.compress(marshal.dumps(code)); item types 0-3 in pyimod01_archive.py lines 28-32" |
|---|
| repo | "https://github.com/pyinstaller/pyinstaller" |
|---|
| commit | "ad07220e06931adbd54d4ad1b7ef955ef2a73713" |
|---|
| path | "PyInstaller/archive/writers.py" |
|---|
| lines | "29-75, 97-110" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "PYZ header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T08:06:30.325Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T16:36:50.302Z" |
|---|
| summary | "data.endianness big added (toc offset packed with '!i'); the writer reserves 17 bytes but writes only the first 12 (magic, bytecode magic, offset)." |
|---|
| changed | |
|---|
|
|
|---|