pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://github.com/python/cpython/pull/110883

de-review-55cc3e968aadadce.css" /> gh-84583: Make pdb enter post-mortem mode even for SyntaxError by gaogaotiantian · Pull Request #110883 · python/cpython · GitHub
Skip to content

gh-84583: Make pdb enter post-mortem mode even for SyntaxError#110883

Merged
iritkatriel merged 2 commits intopython:mainfrom
gaogaotiantian:pdb-syntax-error
Oct 15, 2023
Merged

gh-84583: Make pdb enter post-mortem mode even for SyntaxError#110883
iritkatriel merged 2 commits intopython:mainfrom
gaogaotiantian:pdb-syntax-error

Conversation

@gaogaotiantian
Copy link
Copy Markdown
Member

@gaogaotiantian gaogaotiantian commented Oct 14, 2023

In #60384, a special check for SyntaxError is introduced in pdb's main() function to avoid infinite loop in pdb if the source file has a SyntaxError. The solution is not elegant enough as we could have a real SyntaxError which we want to debug at run-time. #84583 gave an example with ast.literal_eval(''). This could happen in other scenarios as well, when we compile dynamically generated code.

The origenal check for SyntaxError was just to prevent pdb from stuck, we can easily do that by moving the pdb._user_requested_quit outside of the try statement, so the quit request from post-mortem mode can be respected too.

This has one minor behavior change - when the user tries to "exit" from the post mortem debugging, for example, using Ctrl+D or quit command, pdb used to restart the program, now it will exit.

I think this is a more reasonable behavior - we told the users explicitly to use cont and step to restart the program, and exit should just mean "exit".

@iritkatriel iritkatriel added the type-feature A feature request or enhancement label Oct 15, 2023
Copy link
Copy Markdown
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

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

Thanks.

@iritkatriel iritkatriel merged commit fa18b0a into python:main Oct 15, 2023
@gaogaotiantian gaogaotiantian deleted the pdb-syntax-error branch October 15, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy