| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…on non-finite floats
for more information, see https://pre-commit.ci
|
This one is obviously complete junk, it deletes time.py. Blocking and reporting @constructionusvi-create. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
naturaldelta() and naturaltime() raise an uncaught OverflowError when passed a non-finite float (float('inf'), float('-inf')). round()/int() on a non-finite float raises OverflowError, which the except (ValueError, TypeError) clauses do not catch, so it propagates to the caller.
This guards non-finite floats explicitly: inf/-inf/nan pass through unchanged, while huge finite values still raise the documented OverflowError (unchanged).
Adds an oracle test + a disjoint held-out test.
Note: import math is placed inside the two functions to keep the diff minimal; happy to move it to the module-level import block if preferred.