There are C decompilers which will get the Cython extension back to (somewhat readable) C. It won't be the same C code that Cython generated, but it will likely be possible to work out the details of your algorithm. You wouldn't be able to get it back to the original Python/Cython code very easily (but given that Cython generates code in a fairly predictable way it might be possible...)
In particular, things like string constants will be fairly easy to extract from the C file (or even directly from the so file). Since a lot of Python code is based around attribute lookups from string constants (e.g. np.ones(...)
looks up a global with the string constant "np"
, then looks up an attribute with the string constant "ones"
, then some variation of PyObject_Call
), then that code will be fairly easy to decompile. Because of this, a typical Cython extension module is probably a little easier to decompile than a typical C program.
In short you should assume:
- if you've messed up and deleted your .py/.pyx file then you should assume it's lost for good, and you can't get it back.
- If someone else has a sufficient interest in working out what your code does, then you should assume they will be able to do it.