Skip to content

marshal: improve bytes handling - #9047

Merged
JelleZijlstra merged 4 commits into
python:masterfrom
sobolevn:bytes-marshal
Oct 31, 2022
Merged

marshal: improve bytes handling#9047
JelleZijlstra merged 4 commits into
python:masterfrom
sobolevn:bytes-marshal

Conversation

@sobolevn

Copy link
Copy Markdown
Member

Examples:

>>>importmarshal>>>marshal.loads(b'\xe9{\x00\x00\x00')
123>>>marshal.loads(bytearray(b'\xe9{\x00\x00\x00'))
123>>>marshal.loads(memoryview(b'\xe9{\x00\x00\x00'))
123

@hauntsaninjahauntsaninja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lgtm

@github-actions

This comment has been minimized.

Comment threadstdlib/marshal.pyi Outdated
Comment threadstdlib/marshal.pyi Outdated
@@ -1,5 +1,5 @@
from _typeshed import ReadableBuffer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
from_typeshedimportReadableBuffer
from_typeshedimportReadableBuffer, SupportsRead, SupportsWrite

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh you just did that, thanks! GitHub's UI doesn't handle this well: the "Commit" button still shows up on the suggestion but clicking it does nothing. :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Already done ;)

@github-actions

Copy link
Copy Markdown
Contributor

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

@JelleZijlstra
JelleZijlstra merged commit 8036bbd into python:masterOct 31, 2022
Sign up for freeto 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.

3 participants

@sobolevn@JelleZijlstra@hauntsaninja