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

Support error locations in Python tracebacks #1852

Merged
merged 1 commit into from Jul 6, 2021

Conversation

jeanas
Copy link
Contributor

@jeanas jeanas commented Jul 6, 2021

Support both single carets for syntax errors (Python 2 and 3)
and fine-grained error locations with several carets (Python 3.11+).
Previously, the carets were highlighted as operators. This uses
a new token, Token.Punctuation.Marker. For now, no style supports
it specifically. In the future, styles might start differentiating
it from Token.Punctuation.

[Closes #1850.]

Support both single carets for syntax errors (Python 2 and 3)
and fine-grained error locations with several carets (Python 3.11+).
Previously, the carets were highlighted as operators.  This uses
a new token, Token.Punctuation.Marker.  For now, no style supports
it specifically.  In the future, styles might start differentiating
it from Token.Punctuation.

[Closes pygments#1850.]
@birkenfeld
Copy link
Member

Looks mostly good, but the Python 2 markers are still "Operator" in the new test output?

@jeanas
Copy link
Contributor Author

jeanas commented Jul 6, 2021

Maybe the test syntax_error_caret_code.(pytb|py2tb) is too convoluted. The situation is:

>>> ^
  File "<stdin>", line 1
    ^
    ^
SyntaxError: invalid syntax

It tries to ensure that the first caret (invalid code) is highlighted as Operator, while the second (error location) is Punctuation.Marker.

@birkenfeld
Copy link
Member

You're right, of course. Sorry for not looking hard enough.

@birkenfeld birkenfeld merged commit 2cb532d into pygments:master Jul 6, 2021
@birkenfeld
Copy link
Member

Thanks for the PR!

@birkenfeld birkenfeld added the changelog-update Items which need to get mentioned in the changelog label Jul 6, 2021
@jeanas
Copy link
Contributor Author

jeanas commented Jul 6, 2021

Thank you for the quick review and merge!

@Anteru Anteru added this to the 2.10 milestone Dec 12, 2021
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Dec 12, 2021
@jeanas jeanas deleted the pep657 branch September 1, 2023 16:52
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.

Fine-grained error locations in Python tracebacks
3 participants