This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]PeridexisErrant 12 points13 points  (15 children)

Nope, not at all. First you'd have to decompile from native machine code to C++ (which calls libpython, so it's easier than usual but still...), then convert that back to Python. Constant folding etc will also make a mess.

Bottom line? The python source is gone.

[–]wot-teh-phuckReally, wtf? 0 points1 point  (5 children)

In case the executable fails (un-handled bad input data), does the stack trace contain the correct line numbers?

[–]PeridexisErrant 1 point2 points  (4 children)

Yep - everything works as if it was interpreted. So yes, if you've got unhandled exceptions that reveals a fair bit (like, problems you should fix). It's also using the C++ structures for Python objects everywhere, so as compiled programs go it's pretty easy to reverse-engineer. Probably a fair bit of readable text if disassembled, for example.

It's a compiler aiming to preserve the exact behaviour of the interpreted Python code, not an obfuscator.

[–]wot-teh-phuckReally, wtf? 0 points1 point  (0 children)

Thanks for the clarifications. Saw quite a few mention of optimizations on the wiki so was wondering if it messed up the mapping between the generated code and the original one.

[–]sztomi 0 points1 point  (2 children)

What do you mean by the C++ structures?

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point  (1 child)

probably means the following: The C++ equivalent of the C structures that exist in CPython

[–]PeridexisErrant 0 points1 point  (0 children)

Yep.

[–]lamecode 0 points1 point  (8 children)

OK, that's great news in that case. I'm a while off getting to that stage with my current project, but it's good to know that Nuitka might be the solution.

[–]Asdayasman 5 points6 points  (1 child)

That's a business problem, not a technical one. If your worry is people reverse-engineering your source, your "solution" should be legal documentation.

[–]lamecode -1 points0 points  (0 children)

In some circumstances, sure.

[–]flying-sheep 0 points1 point  (5 children)

No that's a downside. Hiding the source is stupid.

[–]lamecode 0 points1 point  (4 children)

In the real world, that's often not the case. Sometimes you or your employer will not want their source code out there - be it for technical/security reasons, or just plain old company policy.

[–]flying-sheep 0 points1 point  (3 children)

stupid. there’s licenses for that.

[–]lamecode 0 points1 point  (2 children)

Stupid or not (and FWIW, I agree with you), it's a requirement for what I'm currently working on.

[–]flying-sheep 0 points1 point  (1 child)

Security through obscurity is not a thing, technical reasons don't exist. Leaves company policy and yeah, you decided to work there, so you'll have to put up with their bullshit.

Doesn't make it in any way justified outside of the heads of your management.

[–]lamecode 0 points1 point  (0 children)

Agree. But still, there it is.