-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
bpo-30938: Add pdb command to show user-owned variables #2732
Conversation
Add a debugger commands "who" and "whos" - similar to the ones from ipython - to list the names of user-owned variables (who) and user-owned variable names together with the variable type and the assigned value. Manually tested. Signed-off-by: David Rieger <david@isan.engineer>
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
@FrontSide, thanks for your PR! By analyzing the history of the files in this pull request, we identified @birkenfeld, @tim-one and @Yhg1s to be potential reviewers. |
Just added my GitHub username to my bugs.python.org profile there. |
Interesting! |
David, this has been open for a while. Are you planning to work on the tests? If not I wouldn't mind trying. |
Go for it @iritkatriel. Would love to see this getting merged : ) |
Is it deliberate that who shows globals and locals while whos shows only locals? |
@iritkatriel mhh, no sounds like a bug. I'd say it should probably always be globals. |
I have some changes to your code in https://github.com/iritkatriel/cpython/tree/whos (I'm not sure how to make a PR into this branch. Also, this branch needs to be rebased). The changes are (1) refactor out the bit that creates the user vars list. (2) I changed the code that iterates over them in whos so that globals are correctly shadowed by locals. For whos, I think there is a lot more work to do to make it render neatly when the values are large. I also added a test for who (but not for whos). |
This PR is stale because it has been open for 30 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition, but I would expect a NEWS entry and a change to the docs so that user are aware.
Closing since this was abandoned by the OP. |
Add debugger commands "who" and "whos" - similar to the
ones from ipython - to list the names of user-owned variables (who)
and user-owned variable names together with the variable type
and the assigned value.
Manually tested.
Example: