GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-86690: pdb: additional documentation on retval by romuald · Pull Request #27612 · python/cpython

Conversation

@romuald

@romuald romuald commented Aug 5, 2021 •
edited by serhiy-storchaka
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Add documentation on retvalstating that the return value itself can be
accessed via the __return__ local variable.

This is intended to let people know that they can access complex objects
using this variable (for example access __return__.thingy())

https://bugs.python.org/issue42524

  • Issue: [doc] pdb access to return value #86690

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@romuald
bpo-42524: pdb: additional documentation on retval
81918c3
Add documentation on `retval`stating that the return value itself can be
accessed via the `__return__` local variable.

This is intended to let people know that they can access complex objects
using this variable (for example access `__return__.thingy()`)
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Aug 5, 2021
@bedevere-bot bedevere-bot added the awaiting review label Aug 5, 2021
iritkatriel
iritkatriel reviewed Aug 5, 2021
View reviewed changes
Comment thread Lib/pdb.py
"""retval
Print the return value for the last return of a function.
Alternatively, the return value can be accessed with the local
variable ``__return__``

@iritkatriel iritkatriel Aug 5, 2021

Copy link
Copy Markdown
Member

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.

Actually this sentence fits better in the documentation here: https://docs.python.org/3/library/pdb.html#pdbcommand-retval

For the docstring it's not really appropriate to point to an alternative.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@iritkatriel iritkatriel added the skip news label Aug 6, 2021
iritkatriel
iritkatriel reviewed Aug 26, 2021
View reviewed changes
Comment thread Lib/test/test_pdb.py
... 'jump 8', # jump over second for loop
... 'return', # return out of function
... 'retval', # display return value
... '__return__', # access the return value

@iritkatriel iritkatriel Aug 26, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

Because the function returns a string, this test doesn't really check that __return__ is the value rather than the string representation of the value. It also doesn't check that you can assign it to a local and inspect it (in other words - the test doesn't show that there is a difference between retval and __return__).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@romuald romuald mannequin mentioned this pull request Apr 10, 2022
[doc] pdb access to return value #86690
Closed
@python-cla-bot

python-cla-bot Bot commented Apr 6, 2025

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

  • [email protected]

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 9, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 12, 2026
@serhiy-storchaka serhiy-storchaka changed the title bpo-42524: pdb: additional documentation on retval gh-86690: pdb: additional documentation on retval Aug 12, 2026
@serhiy-storchaka serhiy-storchaka closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel iritkatriel left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@romuald @iritkatriel @serhiy-storchaka @the-knights-who-say-ni @ezio-melotti @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.