Accept any sequence of header pairs, not just list - #204
Conversation
Callers shouldn't have to copy a tuple or h11 headers object into a list.
| @@ -1,3 +1,3 @@ | |||
| from __future__ import annotations | |||
| from typing import Sequence | |||
There was a problem hiding this comment.
I believe this is already deprecated since Python 3.9 - please use collections to import the related types. See https://docs.python.org/3/library/typing.html#deprecation-timeline-of-major-features.
There was a problem hiding this comment.
Agreed — typing.Sequence is the deprecated alias. Head uses from collections.abc import Sequence now, and the handshake still materializes list(headers) before handing them to h11, so we are not asking h11 to take an arbitrary sequence.
|
CI is green on tests; the remaining mark is |
Tuple-backed header sequences exercise the list() conversions added when Headers widened beyond list.
|
Pushed Sequence-backed header tests (tuple as well as list) for the |
We only iterate header pairs. Typing them as
listmeant a tuple orh11.Headersneeded a pointlesslist(...)copy.Fixes #173