Skip to content

Conversation

@sobolevn
Copy link
Member

Source: https://github.com/python/cpython/blob/85f88f63d96b07208c98a725391af7cb710fe06b/Lib/binhex.py#L216-L234

Both write and write_rsrc calls io.open(..., 'wb').write(data)

@github-actions

This comment has been minimized.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it calls len. I'd say we should add a _BufferWithLen: TypeAlias = ReadableBuffer to _typeshed (or at least add a comment). This would have been useful in at least one other place

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit a96cb58 into python:master Oct 30, 2022
@AlexWaygood
Copy link
Member

Looks like it calls len. I'd say we should add a _BufferWithLen: TypeAlias = ReadableBuffer to _typeshed (or at least add a comment). This would have been useful in at least one other place

I agree with adding this, but why the leading underscore, out of interest?

@hauntsaninja
Copy link
Collaborator

Oh, I don't remember exactly what rules we have for _typeshed, but I wanted to mark as "private / experimental / do not use"... The type doesn't really correspond to its name, it's currently incorrectly typed (e.g. since ReadableBuffer includes pickle.PickleBuffer), we don't know the fate of PEP 688, etc.

@sobolevn
Copy link
Member Author

but I wanted to mark as "private / experimental / do not use"...

+1

@AlexWaygood
Copy link
Member

Cool, that makes sense!

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

Labels

None yet

4 participants