Lost Your Python Source? -- Get it back!
Lost your Python source files? But still
have the .pyc/.pyo files? Get your sources back! Just send in your
.pyc/.pyo file and get the source code mailed back to you within
hours!
The 'decompyle' service converts Python
byte-code back into equivalent Python source. It accepts byte-code
from any Python version starting with 1.5 up to 2.6
The generated source is very readable: docstrings, lists, tuples
and hashes get pretty-printed. Only the comments are missing. To
ensure the source code is correct, we verify the equivalence of the
generated source by compiling it and comparing both byte-codes.
Yes, I want to get my source code back!
News
- Now supports Python 2.6!
- Need to decompyle a py2exe file? Ask us!
- You don't need to hassle with installing 'decompyle': We are now
offering an online service for
'decompylation'. This is very helpfull since you propably need
'decompyle' only once.
- We did a major internal redesign to be prepared for further
enhancements and changes to the Python core.
Features
- decompyles Python byte-code into equivalent Python source
- decompyles byte-code from Python versions 1.5 up to 2.6
- pretty-prints docstrings, hashes, lists and tuples
- only the comments are missing
- we verify wether the generated source is correct (not for personal
service)
How good is decompyle?
- See the examples section for examples.
- Our unit-tests include more than 3900 test-patterns. Each of it is
successfully decompiled for all supported versions, both normal (.pyc)
and optimized (.pyo) bytecode. This is a total of about 138,000
test-cases.
- decompyles and successfully verifies 100% of the Python 1.5, 2.0,
2.1, 2.2, 2.3, 2.4, 2.5 and 2.6 library
- decompyles and successfully verifies 100% of the Python 1.5
library, including lib-stdwin, lib-tk, gnome and gtk.
- To quote some honourable Phthon developer: "Your tool is awefull:
The resulting source is even better than the original one!"
Yes, I want to use this service!
Limitations and Known Bugs
- Starting with Python 2.5 the compiler does simple constant folding
in expressions. This means '2*8 + 1' will just be stored as '17' in
the bytecode. So decompyle has no chance to restore the constant
exprassion which was typed in. Nevertheless the resulting code is
semantically the same.
- The EXTENDED_ARG token is untested (this is a new token for Python
2.0 which is used only if many items exist within a code
object).
Acknowledgement
'decompyle' uses
John Aycock's
generic small languages compiler
'spark'
and his prior work on decompyle.
|