bpo-26669: Reject float infinity in time functions by vstinner · Pull Request #11507 · python/cpython

Conversation

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

* _PyTime_ObjectToDenominator()
* _PyTime_ObjectToTime_t()
* _PyTime_FromSecondsObject()
* _PyTime_FromMillisecondsObject()

@vstinner

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.

@vstinner

I lost track of this issue and so I close it.

Labels