You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NaN handling is unspecified in the docs but the way it's handled is inconsistent with other asyncio functions (asyncio.sleep).
We can create some weird situations when passing NaN in asyncio.timeout like delaying unrelated timers, aborting an idle loop or cancelling unrelated tasks under asyncio.run.
Should asyncio.timeout reject NaN consistent with asyncio.sleep?
Should I also make my fix cover asyncio.timeout_at and Timeout.reschedule? They seem like natural extensions.
Also, definitely see the GIGO point. What makes NaN worth rejecting for me aside from consistency, is that one task's bad input can affect unrelated tasks that supplied valid inputs.
Activity
asvetlov commentedon Dec 3, 2026
I guess yes, NaN argument should be rejected by both
asyncio.timeout()andloop.call_later(), as we do it already forasyncio.sleep()after #105641picnixz commentedon Dec 3, 2026
Personally I see that as a GIGO case where rejecting NaNs seems even an overkill but yeah we can remain consistent.
hu-jeff commentedon Dec 4, 2026
Thanks @asvetlov and @picnixz!
Should I also make my fix cover
asyncio.timeout_atandTimeout.reschedule? They seem like natural extensions.Also, definitely see the GIGO point. What makes NaN worth rejecting for me aside from consistency, is that one task's bad input can affect unrelated tasks that supplied valid inputs.
picnixz commentedon Dec 4, 2026
I think so, and various init constructors. More generally everywhere where it makes sense i think