Skip to content
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

timeout functions now raise ValueError on NaN inputs #2667

Merged
merged 1 commit into from
Jun 25, 2023

Conversation

jakkdl
Copy link
Member

@jakkdl jakkdl commented Jun 23, 2023

Fixes #2493

Consolidated all ValueError tests into a single test.

@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #2667 (d1cbbd3) into master (e917f7c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2667   +/-   ##
=======================================
  Coverage   98.11%   98.11%           
=======================================
  Files         118      118           
  Lines       16534    16539    +5     
  Branches     3001     3003    +2     
=======================================
+ Hits        16222    16227    +5     
  Misses        254      254           
  Partials       58       58           
Impacted Files Coverage Δ
trio/_tests/test_timeouts.py 100.00% <100.00%> (ø)
trio/_timeouts.py 100.00% <100.00%> (ø)

@jakkdl jakkdl requested a review from A5rocks June 23, 2023 12:09
Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

Looks good. 1 genuine comment and 2 filler comments.

trio/_tests/test_timeouts.py Outdated Show resolved Hide resolved
Comment on lines +134 to +136
Args:
seconds (float): The timeout.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a comment that I really don't like how this is so easy to forget :S

Copy link
Member Author

Choose a reason for hiding this comment

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

This sounds like something that can be auto-generated / have the signature displayed in another manner in the doc, once the public interface is fully typed.

trio/_timeouts.py Show resolved Hide resolved
Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

Actually, I just remembered changes like this should probably get a newsfragment!

@jakkdl
Copy link
Member Author

jakkdl commented Jun 24, 2023

Actually, I just remembered changes like this should probably get a newsfragment!

Hah! I've been working so much solely on internal stuff I completely forgot this was a thing, good catch!

Feel free to merge if it looks good otherwise 🚀

Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

Small nitpick. breaking does feel a bit far out but honestly that is probably the best category.

I'll merge (or you can) after blocking CI is fixed.

@@ -0,0 +1 @@
Timeout functions now raise `ValueError` if passed `nan`. This includes `trio.sleep`, `trio.sleep_until`, `trio.move_on_at`, `trio.move_on_after`, `trio.fail_at` and `trio.fail_after`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather "NaN" over "nan"

@jakkdl jakkdl merged commit 3146638 into python-trio:master Jun 25, 2023
33 checks passed
@jakkdl jakkdl deleted the sleep_nan branch June 25, 2023 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

trio.sleep(float('nan')) is valid and sleeps forever
2 participants