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

bpo-26669: Reject float infinity in time functions #11507

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@vstinner
Copy link
Member

vstinner commented Jan 10, 2019

bpo-26669, bpo-35707: Reject -inf and +inf floats in the following C
functions:

  • _PyTime_ObjectToDenominator()
  • _PyTime_ObjectToTime_t()
  • _PyTime_FromSecondsObject()
  • _PyTime_FromMillisecondsObject()

https://bugs.python.org/issue26669

bpo-26669: Reject float infinity in time functions
bpo-26669, bpo-35707: Reject -inf and +inf floats in the following C
functions:

* _PyTime_ObjectToDenominator()
* _PyTime_ObjectToTime_t()
* _PyTime_FromSecondsObject()
* _PyTime_FromMillisecondsObject()
@vstinner

This comment has been minimized.

Copy link
Member

vstinner commented Jan 10, 2019

Currently, passing float("inf") fail with OverflowError("timestamp too large to convert to C _PyTime_t"). With this change, ValueError("invalid value: infinity") is raised explicitly.

... I'm not sure that it's really worth it / the correct behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment