Allow memoryview[bytes] in write() and writelines()#13519
Merged
srittau merged 18 commits intopython:mainfrom Mar 20, 2025
Merged
Allow memoryview[bytes] in write() and writelines()#13519srittau merged 18 commits intopython:mainfrom
srittau merged 18 commits intopython:mainfrom
Conversation
Contributor
Author
|
pytype refuses to allow specifying the type parameter... |
This comment has been minimized.
This comment has been minimized.
Member
|
Should this be ReadableBuffer instead? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
Author
Seems to work, but as python-chess highlights, it will require any subclasses to update their annotations. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
srittau
requested changes
Mar 20, 2025
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
srittau
approved these changes
Mar 20, 2025
Collaborator
|
I'm still unsure what problem pytype has. I'm also not sure whom to ping about this nowadays. Adding the two changes files to tests/pytype_exclude_list.txt might help. |
This comment has been minimized.
This comment has been minimized.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_writer.py:101: error: Unused "type: ignore" comment [unused-ignore]
+ aiohttp/http_writer.py:120: error: Unused "type: ignore" comment [unused-ignore]
|
mmingyu
pushed a commit
to mmingyu/typeshed
that referenced
this pull request
May 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have tests on aiohttp which end up passing
memoryview[bytes]to these methods and they seem to work. With mypy's --strict-bytes it gives a type error due to the missing type in typeshed.