Confusion about passing tuple-type values to the timeout parameter of the Timeout class
#3779
Replies: 1 comment
|
You are not misreading the implementation: the runtime behavior and the public type alias disagree. On current I reproduced the mismatch on that commit: Until the annotation is aligned, the typed equivalent is: timeout = httpx.Timeout(
connect=10.0,
read=30.0,
write=None,
pool=None,
)or: timeout = httpx.Timeout((10.0, 30.0, None, None))If 2- and 3-item tuples are intended to remain supported, Update: I prepared the minimal type-alias change and runtime coverage in a signed commit: encode:b5addb6...SirHegel:2fb3342 It passes |
Uh oh!
There was an error while loading. Please reload this page.
In this code section, it appears that the
timeoutparameter can accept a tuple of length 2 to 4. However, when I do this, the type system reports an error.Reproduction steps:
test_httpx_timeout.pymypy test_httpx_timeout.pyand I get the following error:All reactions