Skip to content

gh-131123: Support completion in pdb for convenience variable attributes - #131124

Merged
gaogaotiantian merged 2 commits into
python:mainfrom
gaogaotiantian:pdb-convvar-completion
Mar 12, 2025
Merged

gh-131123: Support completion in pdb for convenience variable attributes#131124
gaogaotiantian merged 2 commits into
python:mainfrom
gaogaotiantian:pdb-convvar-completion

Conversation

@gaogaotiantian

@gaogaotiantian gaogaotiantian commented Mar 11, 2025

Copy link
Copy Markdown
Member

@picnixz picnixz changed the title gh-131123: Support completion for convenience variable attributes gh-131123: Support completion in pdb for convenience variable attributes Mar 12, 2025
Comment thread Lib/pdb.py
else:
if text.startswith("$"):
# Complete convenience variables
conv_vars = self.curframe.f_globals.get('__pdb_convenience_variables', {})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you use get and in line 985 you don't. Is that correct?

@gaogaotiantian gaogaotiantian Mar 12, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 985 is in a try block which has a KeyError catch. If the first part starts with $ and does not exist in globals, we should just return []. That's also how it handles the other parts.

@gaogaotiantian
gaogaotiantian merged commit b528669 into python:main Mar 12, 2025
@gaogaotiantian
gaogaotiantian deleted the pdb-convvar-completion branch March 12, 2025 21:23
plashchynski pushed a commit to plashchynski/cpython that referenced this pull request Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants