Skip to content

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

Closed
weijay0804 wants to merge 3 commits into
python:mainfrom
weijay0804:fix-issue-105331
Closed

gh-105331: Fix asyncio.sleep() bug#105501
weijay0804 wants to merge 3 commits into
python:mainfrom
weijay0804:fix-issue-105331

Conversation

@weijay0804

@weijay0804weijay0804 commented Jun 8, 2023

Copy link
Copy Markdown
Contributor

@bedevere-bot

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

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

@ghost

ghost commented Jun 8, 2023

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

Comment threadLib/asyncio/tasks.py
"""
yield

def __check_delay(delay):

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Get it!
Thank you

Comment threadLib/asyncio/tasks.py

SEC_TO_NS = 1000 * 1000 * 1000

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
ifnot(isinstance(delay, int) orisinstance(delay, float)):
ifnotisinstance(delay, (int, float)):

Copy link
Copy Markdown
ContributorAuthor

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.

Comment threadLib/asyncio/tasks.py
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

There's no need for single quotes.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok
Thank you

Sign up for freeto 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

@weijay0804@bedevere-bot@Eclips4