Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binhex: improve bytes handling #9035

Merged
merged 7 commits into from
Oct 30, 2022
Merged

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants