__getnewargs__ for a subclass incompatible with return type of supertype #13309
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
topic-inheritance
Inheritance and incompatible overrides
Here is an example commit with the issue: eli-schwartz/meson@4d204bb
mypy.ini: https://github.com/mesonbuild/meson/blob/27626124d0bdd89f5f276f70a73b4713aa3aac3d/.mypy.ini
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.The text was updated successfully, but these errors were encountered: