Skip to content

Capitalized 'syntax error -> 'Syntax error' for syntax error in type comment messages #15236

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

Merged
merged 7 commits into from
May 13, 2023

Conversation

gregorysantosa
Copy link
Contributor

Fixes #15132

1. In my commit I have changed 'syntax error' -> 'Syntax error' for syntax error in type comment within the file 'mypy/message_registry.py. I have also changed all test cases that are related to that stderr message to reflect the proper capitalized error message.

Notes: I did not change the tests for the following test cases despite their messages beginning with lowercase letters because there are no error messages related to printing these messages within 'message_registry.py';
"error: invalid syntax [syntax]"
"can't delete function call"
"can't assign to literal"
"bare * has associated type comment"

…nt' for test cases and the error print in mypy/message_registry.py
…pe comment' for test cases and the error print in mypy/message_registry.py"

This reverts commit 6080839.
…or in type comment' for test cases and the error print in mypy/message_registry.py""

This reverts commit f468fbb.
…'syntax error'->'Syntax error' change. Currently only Syntax error has been changed from the main branch
@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks, looks great!

Yeah, most syntax errors come from Python's AST parser and it's not worth trying to capitalise them:

>>> import ast; ast.parse("del f()")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/shantanu/.pyenv/versions/3.9.9/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    del f()
        ^
SyntaxError: cannot delete function call

@hauntsaninja hauntsaninja merged commit 9ecc4ef into python:master May 13, 2023
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