Skip to content

asyncio.sleep() chokes on surprisingly small numbers #16201

Discussion options

You must be logged in to vote

The limits/boarders may depend on hardwares/architectures because the code you showed runs without error on unix port (x86-64 Linux).
I am not sure if there is a real use case for such a large-ish asyncio.sleep() though.

536_870 / 3_600 / 24 = 6.21 ... [days]

The followings are based on my guess, please consult the relevant parts of sorce code/hardware manuals you are using for details.

A 32-bit signed int can express from -2_147_483_648 to 2_147_483_647.
Because of 1-ms precision, probably, dividing the limit by 1_000 gives 2_147_483, the first border that you mentioned.

For the second one,

2_147_483 / 536_871 = 3.999998 ...
2_147_483 / 536_870 = 4.000005 ...

seems to be related to divis…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by RotatingLlama
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@scruss
Comment options

@peterhinch
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants