Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-105331: Fix asyncio.sleep() bug#105641
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
bedevere-bot commented Jun 11, 2023
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Lib/asyncio/tasks.py Outdated
| """Create a function suitable for use as a task factory on an event-loop. | ||
| Example usage: | ||
| Example usage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation change you (accidentally?) applied to much of this docstring. (Maybe your editor inserted tabs instead of spaces?)
Lib/asyncio/tasks.py Outdated
| """Coroutine that completes after a given time (in seconds).""" | ||
| # check delay value is not nan | ||
| importmath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just move this import to the toplevel, sorted between the rest of the imports.
Lib/asyncio/tasks.py Outdated
| # check delay value is not nan | ||
| importmath | ||
| ifmath.isnan(delay): | ||
| raiseValueError("Invalid value NaN (not a number)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
| raiseValueError("Invalid value NaN (not a number)") | |
| raiseValueError("Invalid delay: NaN (not a number)") |
| @@ -0,0 +1 @@ | |||
| fix asyncio.sleep(float('nan')) does not raise ValueErro problem | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try harder here. The text requires proper punctuation, capitalization, markup, and it should describe the change in behavior rather than just stating "fix the problem".
bedevere-bot commented Jun 11, 2023
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
b3eed28 to 408814dComparec0fa428 to 9bd7cedCompare
kumaraditya303 left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a test for this and versionchanged for docs that nans are now not allowed.
Lib/asyncio/tasks.py Outdated
| """Coroutine that completes after a given time (in seconds).""" | ||
| # check delay value is not nan | ||
| ifmath.isnan(delay): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this check after delay <= 0 check to not slow down the common case of sleep(0).
Misc/NEWS.d/next/Core and Builtins/2023-06-11-09-14-30.gh-issue-105331.nlZvoW.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
…e-105331.nlZvoW.rst I think this way is more clearer. Thank you! Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
gvanrossum left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kumaraditya303 Do you agree?
kumaraditya303 commented Jun 12, 2023
I pushed some minor tweaks, now LGTM. |
* main: pythongh-105540: Fix code generator tests (python#105707) pythongh-105375: Explicitly initialise all{Pickler,Unpickler}Object fields (python#105686) pythongh-105331: Change `asyncio.sleep` to raise ``ValueError` for nan (python#105641) Remove support for legacy bytecode instructions (python#105705)
Issue: gh-105331:
fix asyncio.sleep(float('nan')) does not raise ValueError