You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After spending quite a while one this, I'm not sure if this is an intended mode of operation, a mypy issue or a typeshed issue. If I have this in the wrong place or if it is not an issue, please close and I will re-raise in typeshed if appropriate.
I have run into an issue with inconsistent type-inferences for open() and pathlib.Path().open().
However, running mypy reveal_type on fp and fp1 yields:
Revealed type is 'typing.TextIO'
Revealed type is 'typing.IO[Any]'
I would expect both of these to reveal typing.TextIO. I found this issue when using a routine that switched TextIO output between sys.stdout (TextIO) and a file opened with Path().open() (IO).
This is on python 3.7.2 and mypy 0.700 with arguments: --follow-imports=silent, --show-column-numbers, --disallow-untyped-defs.
The text was updated successfully, but these errors were encountered:
Right now we have a plugin that special-cases builtins.open() but not Path.open(). This should be solved in typeshed by making the definition of Path.open() overloaded on various Literal types. So I am closing this as "not a mypy bug" but I recommend that you submit a PR to typeshed to add this.
After spending quite a while one this, I'm not sure if this is an intended mode of operation, a mypy issue or a typeshed issue. If I have this in the wrong place or if it is not an issue, please close and I will re-raise in typeshed if appropriate.
I have run into an issue with inconsistent type-inferences for open() and pathlib.Path().open().
yields:
However, running mypy reveal_type on fp and fp1 yields:
I would expect both of these to reveal typing.TextIO. I found this issue when using a routine that switched TextIO output between sys.stdout (TextIO) and a file opened with Path().open() (IO).
This is on python 3.7.2 and mypy 0.700 with arguments: --follow-imports=silent, --show-column-numbers, --disallow-untyped-defs.
The text was updated successfully, but these errors were encountered: