Skip to content

Conversation

@gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Nov 4, 2023

if idx < len(args):
self.error(f"Too many arguments for alias '{args[0]}'")
# This is a no-op
return "!"
Copy link
Member

Choose a reason for hiding this comment

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

Why is this return needed?

Copy link
Member Author

@gaogaotiantian gaogaotiantian Nov 4, 2023

Choose a reason for hiding this comment

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

Because onecmd expects a command, and returning a False-like value would be equivalent to returning an empty line - and cmd considers an empty line as "repeat last command". If you do "enter" in pdb, that's repeat last command.


# Replace all the convenience variables
line = re.sub(r'\$([a-zA-Z_][a-zA-Z0-9_]*)', r'__pdb_convenience_variables["\1"]', line)

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@iritkatriel iritkatriel merged commit 853b4b5 into python:main Nov 4, 2023
@gaogaotiantian gaogaotiantian deleted the pdb-alias-check branch November 4, 2023 23:41
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
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.

2 participants