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

Please include a "how to fix it" example in the error message #9236

Closed
bbkane opened this issue Jul 31, 2020 · 1 comment · Fixed by #9243
Closed

Please include a "how to fix it" example in the error message #9236

bbkane opened this issue Jul 31, 2020 · 1 comment · Fixed by #9243

Comments

@bbkane
Copy link

bbkane commented Jul 31, 2020

Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues

Please provide more information to help us understand the issue:

  • Are you reporting a bug, or opening a feature request?

Feature request. A slightly more clear error message, which might be appreciated by folks newer to Python who aren't as familiar with the mini formatting language. If wanted, I'll contribute a pull request to fix this.

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
$ cat tmp.py
print("{}".format(b'abc'))
  • What is the actual behavior/output?
$ mypy tmp.py
tmp.py:1: error: On Python 3 '{}'.format(b'abc') produces "b'abc'"; use !r if this is a desired behavior
Found 1 error in 1 file (checked 1 source file)
  • What is the behavior/output you expect?

I'd love an example of what exactly to change. Something like:

$ mypy tmp.py
tmp.py:1: error: On Python 3 '{}'.format(b'abc') produces "b'abc'"; use !r if this is a desired behavior. Example: '{!r}'.format(b'abc'
Found 1 error in 1 file (checked 1 source file)
  • What are the versions of mypy and Python you are using?
$ python3 --version
Python 3.7.6
$ mypy --version
mypy 0.770

Do you see the same issue after installing mypy from Git master?

The error source code is still the same in Git master

  • What are the mypy flags you are using? (For example --strict-optional)

No flags

  • If mypy crashed with a traceback, please paste
    the full traceback below.

(You can freely edit this text, please remove all the lines
you believe are unnecessary.)

hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Aug 2, 2020
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Aug 2, 2020
@hauntsaninja
Copy link
Collaborator

I had a colleague get confused by this error message recently too. Linked PR should resolve :-)

hauntsaninja added a commit that referenced this issue Aug 2, 2020
Resolves #9236 

Co-authored-by: hauntsaninja <>
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 a pull request may close this issue.

2 participants