C++ python bytecode disassembler and decompiler
  • C++ 84.5%
  • Python 14.9%
  • CMake 0.5%
Find a file
2025-07-02 07:56:28 -07:00
.github/workflows Update to upload-artifact/v4 to fix CI 2025-06-30 19:21:38 -07:00
bytes Remove additional specialized opcode that wasn't ordered with the others 2024-08-12 11:39:36 -07:00
scripts Add basic bytecode and disassembly support for Python 3.12 2023-11-09 12:17:03 -08:00
tests Merge branch 'master' into new-opcodes 2025-07-02 07:56:28 -07:00
.gitignore Support END_FOR opcode 2025-07-01 09:22:56 +05:30
ASTNode.cpp Return back a fix for Centos6/7 compilation issues not related to shadow ones 2024-03-12 22:58:43 +02:00
ASTNode.h Fix FORMAT_VALUE for values that have both a conversion and a format_spec. 2024-08-01 13:28:43 -07:00
ASTree.cpp Merge branch 'master' into new-opcodes 2025-07-02 07:56:28 -07:00
ASTree.h Use C++ streams over C style IO 2023-06-02 01:12:59 +02:00
bytecode.cpp Add JUMP_BACKWARD + CACHE comments 2025-07-01 09:22:57 +05:30
bytecode.h Refactor disassembly operand formatting to remove single-use functions. 2023-11-30 10:16:00 -08:00
bytecode_ops.inl Remove additional specialized opcode that wasn't ordered with the others 2024-08-12 11:39:36 -07:00
CMakeLists.txt Test runner refactor (#508) 2024-08-08 15:55:35 -07:00
data.cpp Fix the pointer's behavior on getting buffer 2023-08-25 18:00:26 -07:00
data.h Fix some issues with formatted_print: 2023-06-05 13:49:04 -07:00
FastStack.h Merge branch 'master' into new-opcodes 2025-07-02 07:56:28 -07:00
LICENSE Added GPL v3 license file 2009-07-25 00:43:46 +00:00
pyc_code.cpp Adjust CO_FUTURE_ flags to match Python 3.8 changes, and add some missing flags 2024-08-04 12:55:28 -07:00
pyc_code.h Adjust CO_FUTURE_ flags to match Python 3.8 changes, and add some missing flags 2024-08-04 12:55:28 -07:00
pyc_module.cpp Python 3.13 initial support (#497) 2024-08-07 15:39:40 -07:00
pyc_module.h Python 3.13 initial support (#497) 2024-08-07 15:39:40 -07:00
pyc_numeric.cpp Fix Long Numeric Integer representation for Python 3 2024-06-22 23:19:18 +02:00
pyc_numeric.h Fix Long Numeric Integer representation for Python 3 2024-06-22 23:19:18 +02:00
pyc_object.cpp Don't create special objects for NULL, just use NULL directly. 2017-07-05 16:36:04 -07:00
pyc_object.h Remove unnecessary template parameter in destructor. Fixes #487 2024-05-30 14:56:07 -07:00
pyc_sequence.cpp Simplify PycDict key/value storage a bit 2023-11-09 15:05:55 -08:00
pyc_sequence.h Restore changes for shadow warnings... 2024-03-12 22:55:56 +02:00
pyc_string.cpp Restore changes for shadow warnings... 2024-03-12 22:55:56 +02:00
pyc_string.h Restore changes for shadow warnings... 2024-03-12 22:55:56 +02:00
pycdas.cpp Add one more missed flag: CO_ASYNC_GENERATOR (#505) 2024-08-05 12:35:10 -07:00
pycdc.cpp Clean up file handling in main()s, and remove a leak 2023-06-05 13:54:26 -07:00
README.markdown Run tests in parallel or only some with a filter 2024-06-19 17:56:06 +02:00

Decompyle++

A Python Byte-code Disassembler/Decompiler

Decompyle++ aims to translate compiled Python byte-code back into valid and human-readable Python source code. While other projects have achieved this with varied success, Decompyle++ is unique in that it seeks to support byte-code from any version of Python.

Decompyle++ includes both a byte-code disassembler (pycdas) and a decompiler (pycdc).

As the name implies, Decompyle++ is written in C++. If you wish to contribute, please fork us on github at https://github.com/zrax/pycdc

Building Decompyle++

  • Generate a project or makefile with CMake (See CMake's documentation for details)

    • The following options can be passed to CMake to control debug features:
      Option Description
      -DCMAKE_BUILD_TYPE=Debug Produce debugging symbols
      -DENABLE_BLOCK_DEBUG=ON Enable block debugging output
      -DENABLE_STACK_DEBUG=ON Enable stack debugging output
  • Build the generated project or makefile

    • For projects (e.g. MSVC), open the generated project file and build it
    • For makefiles, just run make
    • To run tests (on *nix or MSYS), run make check JOBS=4 (optional FILTER=xxxx to run only certain tests)

Usage

To run pycdas, the PYC Disassembler: ./pycdas [PATH TO PYC FILE] The byte-code disassembly is printed to stdout.

To run pycdc, the PYC Decompiler: ./pycdc [PATH TO PYC FILE] The decompiled Python source is printed to stdout. Any errors are printed to stderr.

Marshalled code objects: Both tools support Python marshalled code objects, as output from marshal.dumps(compile(...)).

To use this feature, specify -c -v <version> on the command line - the version must be specified as the objects themselves do not contain version metadata.

Authors, Licence, Credits

Decompyle++ is the work of Michael Hansen and Darryl Pogue.

Additional contributions from:

  • charlietang98
  • Kunal Parmar
  • Olivier Iffrig
  • Zlodiy

It is released under the terms of the GNU General Public License, version 3; See LICENSE file for details.