-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
mypy gets confused by double coding cookie #1281
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
Comments
I remember reading through the PEP and the docs about this when I was considering picking up #522. I was slightly surprised that neither of them seem to document the expected behaviour when both the first and second lines contain a valid encoding comment. However it's entirely possible that I missed something, and in any case it's probably best to match the behaviour of CPython as you suggest. |
FWIW I clarified this in the PEP. |
When two coding cookies are present, use the first. Fixes #1281.
The regular expression that matches the current behavior of CPython is You should check the BOM, the first line can be blank, and |
Thanks! We do the bom checking elsewhere and I've already updated the
regex according to your earlier advice
(8f3381c).
|
When a file has two different coding cookies (one in line 1, one in line 2) mypy gets confused and uses the cookie from the second line. It should use the first.
Low priority; I found this by accident and the new parser will presumably make this go away.
The text was updated successfully, but these errors were encountered: