Skip to content

fix types in io#3485

Closed
christopher-hesse wants to merge 2 commits into
python:masterfrom
christopher-hesse:patch-5
Closed

fix types in io#3485
christopher-hesse wants to merge 2 commits into
python:masterfrom
christopher-hesse:patch-5

Conversation

@christopher-hesse

Copy link
Copy Markdown
Contributor

It's not clear to me what the relation between BufferedIOBase and IO[bytes] is, but according to the io docs the current code seems incorrect.

@christopher-hesse

Copy link
Copy Markdown
Contributor Author

The fact that the tests fail makes me think this is not correct. I'm not certain why that is though.

@christopher-hesse

Copy link
Copy Markdown
Contributor Author

Guess this should be two PRs.

@srittau srittau added the status: deferred Issue or PR deferred until some precondition is fixed label Dec 3, 2019
@srittau

srittau commented Dec 3, 2019

Copy link
Copy Markdown
Collaborator

IO types are quite problematic in typeshed at the moment. Changes tend to break lots of code. The ultimate goal is to use protocols for parameter types and concrete types as return values. Attributes and other cases must be looked at on a case-by-case basis. But we are still a long way off from that goal. I've marked this PR as "deferred" for now.

@christopher-hesse

Copy link
Copy Markdown
Contributor Author

Thanks, I noticed the odd lack of protocols after trying to use type checking with io objects for a bit and ended up using some dumpy fake protocol: https://github.com/cshesse/blobfile/blob/master/blobfile/ops.py#L1065 and cast()ing return values to pretend to be the correct types.

@srittau srittau added the topic: io I/O related issues label May 28, 2020
@JelleZijlstra

Copy link
Copy Markdown
Member

Superseded by #4145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: deferred Issue or PR deferred until some precondition is fixed topic: io I/O related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants