C++ python bytecode disassembler and decompiler
  • C++ 84.5%
  • Python 14.9%
  • CMake 0.5%
Find a file
John Richards ed11ba3fe4 Refactors how we handle NaN and infinity
The previous approach didn't work properly under MSVC. The wrong
output would be produced for NaN values.

This new approach will directly print out "nan" and "inf" with the
appropriate sign, rather than just wrapping the value in float('').
2020-10-15 21:35:19 -04:00
.github/workflows GH Actions apparently use PowerShell by default now -- fix syntax error. 2020-01-03 14:38:36 -08:00
bytes Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
scripts Add support for Python 3.9 in pymultic. 2020-10-12 16:52:38 -07:00
tests Handle NaN and infinity values 2020-10-15 21:04:57 -04:00
.gitignore Switch build system to CMake 2014-06-10 19:20:56 -07:00
ASTNode.cpp Fix non-inplace matrix multiplication operator. 2019-10-10 11:47:48 -07:00
ASTNode.h Fix non-inplace matrix multiplication operator. 2019-10-10 11:47:48 -07:00
ASTree.cpp Fixed crash on stack_history being empty 2020-02-10 11:02:26 +01:00
ASTree.h Fixed imports, and restructured ifs to be "code blocks" 2010-09-07 21:32:34 -07:00
bytecode.cpp Refactors how we handle NaN and infinity 2020-10-15 21:35:19 -04:00
bytecode.h Update bytecode for Python 3.6 beta3, and use a common file for opcode names 2016-11-08 16:00:56 -08:00
bytecode_ops.inl Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
CMakeLists.txt Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
data.cpp Fix several undefined behavior issues identified by @nrathaus. 2018-01-28 15:37:44 -08:00
data.h Start requring C++11 with explicit virtual overrides. 2019-10-02 14:41:49 -07:00
FastStack.h Modernize and simplify FastStack with a vector. 2019-10-09 15:39:37 -07:00
LICENSE Added GPL v3 license file 2009-07-25 00:43:46 +00:00
pyc_code.cpp Add bytecode and disassembly support for Python 3.8. 2019-10-14 14:48:26 -07:00
pyc_code.h Add bytecode and disassembly support for Python 3.8. 2019-10-14 14:48:26 -07:00
pyc_module.cpp Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
pyc_module.h Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
pyc_numeric.cpp Clean up some loops with range-based for. 2019-10-04 15:56:24 -07:00
pyc_numeric.h Use std::string instead of manual character buffers where applicable. 2019-10-02 16:01:54 -07: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 Make PycRef<T> movable 2019-10-08 08:42:33 -07:00
pyc_sequence.cpp Remove unnecessary complexity and just use the base sequence type common 2018-04-28 11:37:13 -07:00
pyc_sequence.h Start requring C++11 with explicit virtual overrides. 2019-10-02 14:41:49 -07:00
pyc_string.cpp Fixed a crash when a Stringref was an empty string (length 0) 2020-02-10 10:40:17 +01:00
pyc_string.h Unmangle private names ('__' prefix) in class declarations. 2019-10-10 14:47:48 -07:00
pycdas.cpp Add bytecode and disassembly support for Python 3.8. 2019-10-14 14:48:26 -07:00
pycdc.cpp Fix several undefined behavior issues identified by @nrathaus. 2018-01-28 15:37:44 -08:00
PythonBytecode.txt Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
README.markdown Fix #51 by adding more precise build instructions 2014-12-03 18:07:27 -08: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)
  • 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 test

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.

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.