Open
Description
Here is an example commit with the issue: eli-schwartz/meson@4d204bb
mypy.ini: https://github.com/mesonbuild/meson/blob/27626124d0bdd89f5f276f70a73b4713aa3aac3d/.mypy.ini
$ mypy --version
mypy 0.961 (compiled: yes)
$ mypy mesonbuild/interpreter/primitives/string.py
mesonbuild/interpreter/primitives/string.py:211:5: error: Return type "Tuple[str, str]" of "__getnewargs__" incompatible with return type "Tuple[str]" in supertype "str"
I subclassed str and treat it specially with its own incompatible __new__()
to enforce a specific creation pattern. After discovering I need to pickle it as well, I added a __getnewargs__()
which is also incompatible. mypy is happy with my incompatible new, but not with the getnewargs that needs to match the argument contract of new.