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

str-bytes-safe displays position in line incorrectly #7740

Closed
jolaf opened this issue Oct 17, 2019 · 1 comment
Closed

str-bytes-safe displays position in line incorrectly #7740

jolaf opened this issue Oct 17, 2019 · 1 comment

Comments

@jolaf
Copy link
Contributor

jolaf commented Oct 17, 2019

The following code:

s = '%s%s' % (b''.decode(), b'')

produces the following output:

$ python3 Test.py
$ mypy --show-column-numbers --pretty --show-error-codes Test.py 
Test.py:1:15: error: On Python 3 '%s' % b'abc' produces "b'abc'"; use %r if this is a desired behavior  [str-bytes-safe]
    s = '%s%s' % (b''.decode(), b'')
                  ^
Found 1 error in 1 file (checked 1 source file)
$ mypy --version
mypy 0.740
$ python3 --version
Python 3.6.8

Note that the indicated position of the error in the line is pointing to the first argument (b''.decode()) instead of the seconds one (b'') which is highly misleading.

@jolaf jolaf changed the title str-bytes-safe displays position str-bytes-safe displays position in line incorrectly Oct 17, 2019
@ilevkivskyi
Copy link
Member

Duplicate of #7528

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

No branches or pull requests

2 participants