Skip to content

gh-105331: Fix asyncio.sleep() bug #105501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

gh-105331: Fix asyncio.sleep() bug #105501

wants to merge 3 commits into from

Conversation

weijay0804
Copy link
Contributor

@weijay0804 weijay0804 commented Jun 8, 2023

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost
Copy link

ghost commented Jun 8, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@@ -639,10 +639,34 @@ def __sleep0():
"""
yield

def __check_delay(delay):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Does it really need double underscore? If you want to mark something as "private API" use one leading underscore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get it!
Thank you


SEC_TO_NS = 1000 * 1000 * 1000

if not (isinstance(delay, int) or isinstance(delay, float)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not (isinstance(delay, int) or isinstance(delay, float)):
if not isinstance(delay, (int, float)):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! This is much clearer now.

SEC_TO_NS = 1000 * 1000 * 1000

if not (isinstance(delay, int) or isinstance(delay, float)):
raise TypeError(f"'{type(delay)} object cannot be interpreted as an integer'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise TypeError(f"'{type(delay)} object cannot be interpreted as an integer'")
raise TypeError(f"{type(delay)} object cannot be interpreted as an integer")

There's no need for single quotes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok
Thank you

@weijay0804 weijay0804 closed this Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants