Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Prev Previous commit
Next Next commit
reorder the if checks
  • Loading branch information
gaogaotiantian committed Apr 16, 2025
commit a3401e92754c148abd956f619d9829bc98a5c748
4 changes: 2 additions & 2 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,9 @@ def default(self, line):
except Exception as e:
Comment thread
gaogaotiantian marked this conversation as resolved.
Outdated
# Maybe it's an await expression/statement
if (
isinstance(e, SyntaxError)
self.async_shim_frame is not None
and isinstance(e, SyntaxError)
and e.msg == "'await' outside function"
and self.async_shim_frame is not None
):
try:
self._exec_await(buffer, globals, locals)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be run without the exception from line 891 in the context

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.

I restructured the code as we know whether it is an await code during compile. The nice side effect is that we don't need to execute the code under the exception context.

Expand Down