rocky / rocky/python-decompile3

Python 3.11+ partial workaround

Open
#172 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.3k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository file, test, or entry point; start by reviewing the linked py-fake_decompile implementation and comparing its Python 3.11+ behavior with this project. Done would require a concrete decision on integrating or linking the workaround and repository-specific validation, but the issue does not define that validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
reverse-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.