pyc_revive
.pyc -> .py reconstructor. no uncompyle6. no pycdc. no xdis.
use
python -m pyc_revive my file.pyc
python -m pyc_revive ./dist/app.pyc --out ./revived.py
input handling: exact path, spaces with no quotes, basename search in cwd + all subfolders + parent folder.
versions
every CPython from 2.0 through 3.15 resolves by magic number
(pymagic.py, full table + nearest fallback + header sizes).
two backends, one pipeline:
- native:
.pycmatches the running interpreter. stdlib marshal loads the code object, stdlib dis disassembles. zero dependencies. - pycdas: anything else. the bundled
pycdas.exedisassembles the foreign version,pycdas_parser.pyparses the dump into code trees,shim.pyadapts them to the pipeline. everything downstream (normalize, segment, translate, CFG, emit, verify x3) runs unchanged.
pipeline
- find file (
finder.py) - detect version via magic (
pymagic.py) - load: native marshal, else pycdas backend (
loader.py,pycdas_parser.py,shim.py) - disassemble + abstract (
bytecode.py:Inst,EditableBytecode, opcode/oparg/value-stack/metadata tables) - normalize / mask consts + names (
normalizer.py) - opcode-aware B/I/E segmentation (
segmenter.py) - statement translation (
translator.py: stack machine, defaults recovery, lambdas inline, 2.x print/exec/class ops) - control-flow graph from jumps (
cfg.py: if/for/while/try/except-as (bareexcept:too)/with/finally, clauses + clusters, 3.11+ exception table, SETUP-region splits) - emit + repairs (
emitter.py: source-order splicing onto def/class stub lines, bases recovery,@decoratorrestore,globaldecls, cond chains, ternaries, nested if/else, loop ranges, break/continue recovery, indent + suite-guard passes) - equivalence verify, 3 sweeps (
verifier.py: recompile revived source, compare opcode structure, repair, repeat x3)
layout
pyc_revive/
finder.py pymagic.py loader.py pycdas_parser.py shim.py
bytecode.py normalizer.py segmenter.py translator.py cfg.py
emitter.py verifier.py reconstructor.py cli.py __main__.py
pycdas.exe README.md requirements.txt
known limits
- inline comprehensions/genexps render as
func(...)placeholders. trybodies that fall through into always-run handlers keep flat order instead of guarded flow.- exotic decorators reduce to bare defs; exotic call shapes degrade to commented disassembly rather than failing.
- pre-3.8 default-argument recovery is best-effort (flag-style MAKE from 3.8+ recovers exactly).
- verifier scores dip across versions: opcode sets drift between releases, so cross-version similarity reads lower than same-version.
Metadata
Release files for pyc-revive 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyc_revive-1.0.0.tar.gz | 784.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyc_revive-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.6 MB
Release files / pyc_revive-1.0.0.tar.gz
| Download URL | pyc_revive-1.0.0.tar.gz |
|---|---|
| Size | 784.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf870b955d54564841e7ff3c41564c69333a662df9546309894e0eaddda962ee
|
|
BLAKE2b-256 checksum How to use checksums |
b520c5443e0a40b97e097dba1f282c9d9e367c58b0ea0c19574591bba756bdf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|
Release files / pyc_revive-1.0.0-py3-none-any.whl
| Download URL | pyc_revive-1.0.0-py3-none-any.whl |
|---|---|
| Size | 793.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
783d8046ff7d99193a723746071c56250dda090f980dda89b5e386bf1d4672ba
|
|
BLAKE2b-256 checksum How to use checksums |
442b5d6e6d2abb5cc7eea6c17c72c7e3618c674a11118d99f630e759df476e0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|