-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-131123: Support completion in pdb
for convenience variable attributes
#131124
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
gh-131123: Support completion in pdb
for convenience variable attributes
#131124
Conversation
pdb
for convenience variable attributes
for part in dotted[1:-1]: | ||
obj = getattr(obj, part) | ||
except (KeyError, AttributeError): | ||
return [] | ||
prefix = '.'.join(dotted[:-1]) + '.' | ||
return [prefix + n for n in dir(obj) if n.startswith(dotted[-1])] | ||
else: | ||
if text.startswith("$"): | ||
# Complete convenience variables | ||
conv_vars = self.curframe.f_globals.get('__pdb_convenience_variables', {}) |
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.
Here you use get
and in line 985 you don't. Is that correct?
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.
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.
pdb
for convenience variables #131123