-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[doc] pdb access to return value #86690
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
When using the pdb module, there is currently no way to easy access the current return value of the stack This return value is accessed by the 'retval command' I propose using the currently unused argument to allow storing the return value in the local variables, accessible via the debugger For example: def foo():
debugger()
return ComplexObject()
def bar():
return foo() (pdb) retval |
It actually is in the locals, and it's called __return__. So you can access it with locals()['__return__'] I'll try to see where that can be documented. |
I just noticed your PR. Would you like to continue working on this? I think we should update the documentation of retval (in the doc and in the function's doctring) to say: """ Then add unit tests and examples as you did. |
I'm not sure I follow. You wish to "simply" update the doc? (and not update the retval to allow storing it into a varible. I'm OK with that) But if we choose this, I'm not sure what needs changing in the doctests :-? Another interrogation: is the use locals() really necessary? I can see that I can simply use |
Yes, exactly - to update the doc so that the next person who needs it will easily find a way to do it (which was not available to you when you created this issue). The test should assert that what the doc says, so that if someone breaks documented functionality we will immediately know. Your point about accessing __return__ directly from the prompt is interesting - sure, if that works just document that and make sure the test fails if we make a change that breaks it. |
The return value can be accessed with |
retval [variable]
option to pdb #23601Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: