-
-
Notifications
You must be signed in to change notification settings - Fork 245
patch inspect.getsource so that I can get the source of interactively defined functions #229
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
Comments
Along these lines, I already patch inspect.getsource to get the source of Python builtin functions via https://github.com/punchagan/cinspect in my python startup file. If we're going to use a modified inspect.getsource, might also be cool to check to see if this is installed and use it as well. |
I just looked briefly but I don't understand how IPython is doing this. |
I think we should do this by making our own versions of a few of the methods in inspect.py (the standard library module) so we can pass our history to them. |
Looks like ipython does this by compiling functions with unique filenames for each prompt. |
- Patches the linecache module to achieve this - inspect.getsource() works for functions defined on the console - tracebacks show code for frames inside interactively defined functions fixes bpython#229
- Patches the linecache module to achieve this - inspect.getsource() works for functions defined on the console - tracebacks show code for frames inside interactively defined functions fixes bpython#229
- Patches the linecache module to achieve this - inspect.getsource() works for functions defined on the console - tracebacks show code for frames inside interactively defined functions fixes bpython#229
It seems like bpython is already saving a history of everything I type (so that it can be printed on exit); it would be really nifty if 'inspect.getsource' could show me the source of a function so that I could save things out individually.
The text was updated successfully, but these errors were encountered: