PyCQA / pycodestyle Public
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
Python 2.6: false positive W605 invalid escape sequence #755
Comments
Fixes false positive:
./tests/test_decode.py:414:19: W605 invalid escape sequence '\s'
PyCQA/pycodestyle#755
|
I don't think our checks are specific to Python versions. That said, I think the error message could be improved. And a PR to clarify what's "invalid" about it (for Python 3.7) is needed. That would allow folks to |
|
@sigmavirus24, afaik, the warning is changed since python 3.6 |
|
I'm sorry @seeeturtle, could you rephrase? I'm having trouble understanding your question. |
|
Sorry for too short explanation
https://bugs.python.org/issue27364 https://docs.python.org/3.6/whatsnew/3.6.html#deprecated-python-behavior Based on the above three, I thought that the patch of rasing Am I talking right? |
|
Oh sorry, I think my earlier comments were too short too So, the warning was introduced in 3.6 but those escape sequences aren't invalid yet. I think we added the check because the invalid syntax error was going to be introduced in 3.7. Also, while discussing misunderstandings: I misunderstood what @jwilk was suggesting was the problem here. The problem here is how python 2.6 tokenizes bytestrings. I think we can fix that easily Sorry for the confusion. |
Python 2.6 has a bug (https://bugs.python.org/issue15054) that prevents us from tokenizing strings properly that are b'' strings. This means we cannot reliably detect future deprecated escape sequences on 2.6 Closes PyCQAgh-755
Python 2.6 has a bug (https://bugs.python.org/issue15054) that prevents us from tokenizing strings properly that are b'' strings. This means we cannot reliably detect future deprecated escape sequences on 2.6 Closes PyCQAgh-755
|
No problem :) |
|
@seeeturtle absolutely! |
|
@sigmavirus24, it seems W605 will be changed into Error starting with Python 3.8 not Python 3.7 since it breaks a lot of code. Note: btw, where can i add some notes for certain warning in docs? |
|
This also triggers a false positive for lines defining a regex: import re
re.match("^([-+]?\d+|^\d+%)$", string) |
|
@gdevenyi this is intended as you should be using a raw strings for regular expressions in most cases. |
|
Hrm, okay, it works with a raw string. |
|
The sequence |
I'm getting this false positive:
I suspect this is caused by Python issue #15054.
You may want to disable W605 for Python 2.6.
The text was updated successfully, but these errors were encountered: