Skip to content
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-102114: Make dis print more concise tracebacks for syntax errors in str inputs #102115

Merged
merged 10 commits into from
Apr 15, 2023

Conversation

chgnrdv
Copy link
Contributor

@chgnrdv chgnrdv commented Feb 21, 2023

This commit reworks code of '_try_compile' function so that it print shorter traceback if its 'source' argument contains indentation/syntax error
@chgnrdv chgnrdv changed the title gh-102114: Make _try_compile print shorter traceback gh-102114: Make dis._try_compile print shorter traceback Feb 21, 2023
@arhadthedev arhadthedev added the stdlib Python modules in the Lib dir label Feb 21, 2023
Copy link
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 for the PR, your change makes sense. However, we would need a unit test covering this behaviour to prevent future regressions.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@iritkatriel iritkatriel added the 3.12 bugs and security fixes label Apr 6, 2023
Lib/test/test_dis.py Outdated Show resolved Hide resolved
chgnrdv and others added 2 commits April 14, 2023 21:02
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Lib/dis.py Outdated Show resolved Hide resolved
Lib/dis.py Outdated Show resolved Hide resolved
Copy link
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.

Yes, that's better.

@iritkatriel iritkatriel changed the title gh-102114: Make dis._try_compile print shorter traceback gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs Apr 15, 2023
@iritkatriel iritkatriel merged commit 2b6f5c3 into python:main Apr 15, 2023
carljm added a commit to carljm/cpython that referenced this pull request Apr 17, 2023
* main:
  Remove `expert-*` from `project-updater` GH workflow (python#103579)
  pythongh-103583: Add codecs and maps to _codecs_* module state (python#103540)
  pythongh-48330: address review comments to PR-12271 (python#103209)
  pythongh-103527: Add multibytecodec.h as make dep for _codecs_* (python#103567)
  pythongh-103553: Improve `test_inspect`: add more assertions, remove unused (python#103554)
  pythonGH-103517: Improve tests for `pathlib.Path.walk()` (pythonGH-103518)
  pythongh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (python#102115)
  pythonGH-78079: Fix UNC device path root normalization in pathlib (pythonGH-102003)
  pythongh-101517: Add regression test for a lineno bug in try/except* impacting pdb (python#103547)
  pythongh-103527: Add make deps for _codecs_* and _multibytecodec (python#103528)
  pythongh-103532: Fix reST syntax in NEWS entry (pythonGH-103544)
  pythongh-103532: Add NEWS entry (python#103542)
carljm added a commit to carljm/cpython that referenced this pull request Apr 17, 2023
* superopt:
  update generated cases with new comment
  review comments
  Remove `expert-*` from `project-updater` GH workflow (python#103579)
  pythongh-103583: Add codecs and maps to _codecs_* module state (python#103540)
  pythongh-48330: address review comments to PR-12271 (python#103209)
  pythongh-103527: Add multibytecodec.h as make dep for _codecs_* (python#103567)
  pythongh-103553: Improve `test_inspect`: add more assertions, remove unused (python#103554)
  pythonGH-103517: Improve tests for `pathlib.Path.walk()` (pythonGH-103518)
  pythongh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (python#102115)
  pythonGH-78079: Fix UNC device path root normalization in pathlib (pythonGH-102003)
  pythongh-101517: Add regression test for a lineno bug in try/except* impacting pdb (python#103547)
  pythongh-103527: Add make deps for _codecs_* and _multibytecodec (python#103528)
  pythongh-103532: Fix reST syntax in NEWS entry (pythonGH-103544)
  pythongh-103532: Add NEWS entry (python#103542)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dis._try_compile: traceback printed on error in source argument is too wordy
4 participants