-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codegood-first-issuepriority-1-normal
Description
- Please insert below the code you are checking with mypy.
class HexBytes(bytes):
def __str__(self) -> str:
return self.hex()
value = HexBytes(b"aaa")
print(f"{value}")- What is the actual behavior/output?
$ python3 mypy_bytes_subclass.py
616161
$ mypy mypy_bytes_subclass.py
mypy_bytes_subclass.py:6: 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 would expect no error to be produced in this situation, as __str__ has been overridden, so the code does not exhibit the behaviour mentioned in the error.
- What are the versions of mypy and Python you are using?
Do you see the same issue after installing mypy from Git master?
mypy 0.760, python 3.7.5
The same issue appears with mypy-0.770+dev.e7866d0839202234db1f975a68a9284bb59d8544 (installed from git)
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codegood-first-issuepriority-1-normal