| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| return (bytes(self._receive_buffer), self._receive_buffer_closed) | ||
|
|
||
| def receive_data(self, data: bytes) -> None: | ||
| def receive_data(self, data: Union[bytes, bytearray, memoryview]) -> None: |
There was a problem hiding this comment.
It would be better to use collections.abc.Buffer for Python >= 3.12, as introduced in PEP 688. Alternatively, you can use if typing.TYPE_CHECKING: from typing_extensions import Buffer, which avoids a runtime dependency on typing_extensions.
Sorry, something went wrong.
|
|
||
| def __iadd__(self, byteslike: Union[bytes, bytearray]) -> "ReceiveBuffer": | ||
| def __iadd__( | ||
| self, byteslike: Union[bytes, bytearray, memoryview] |
There was a problem hiding this comment.
ditto
Sorry, something went wrong.
|
|
||
|
|
||
| @pytest.mark.parametrize("data_wrapper", [bytearray, memoryview]) | ||
| def test_receive_data_accepts_byteslike_objects(data_wrapper: Any) -> None: |
There was a problem hiding this comment.
Does this parameter need to be Any?
Sorry, something went wrong.
There was a problem hiding this comment.
No. This is just statistically generated spam. This account is brand new and spamming tonnes of projects
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Why
Issue #186 points out that receive_data() already operates on bytes-like input, but its public annotation is still narrower than the runtime behavior. Widening the concrete accepted types removes false positives for downstream users adopting stricter bytes checking while keeping this patch intentionally small for h11's current typing/tooling baseline.
Validation
Fixes #186.