Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11+ partial workaround #172

Open
perkinslr opened this issue Nov 2, 2024 · 0 comments
Open

Python 3.11+ partial workaround #172

perkinslr opened this issue Nov 2, 2024 · 0 comments

Comments

@perkinslr
Copy link

perkinslr commented Nov 2, 2024

Description

I need the ability to obtain function source code at runtime for various introspection purposes. Since Python 3.9+, and Python3.11 even more, cannot be easily decompiled, I cheated. The results are here.

While properly decompiling code is needed for dynamically generated code, complex template logic, and when you don't have the original source code available, sometimes it's sufficient to simply automate fetching the relevant lines of source code out of the source file.

The fake decompiler is zlib licensed, so you're welcome to hoist it into your own stuff if you like, or just link to it on the readme. Hopefully it will be of some use.

Note that I'm out of time to implement recreating the function signature to support lambdas better. It should take maybe half an hour to do, just need to extract the arguments and stringify them suitably. Faking signatures works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant