This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Justin Fay
Recipients Justin Fay, cheryl.sabella, eric.smith, mangrisano
Date 2019-05-30.09:03:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559206994.89.0.455382336788.issue37086@roundup.psfhosted.org>
In-reply-to
Content
From looking at the code for this (note I am not a C programmer so may have gotten this wrong) _PyTime_FromObject first checks if the object is a float using PyFloat_Check(obj) this is evident as passing nan to time.sleep raises a ValueError with the message "Invalid value NaN (not a number)". However if the object is not a float it next assumes the only valid value to be an integer, this logic appears fine to me. The problem however is if the object is not an integer the code raises the error with the message that an integer is required, it is unaware that a before this branch of the code executes a float would have been an accepted value. In python I imagine the fix for this would be along the lines

try:
    float(obj)
except (TypeError, ValueError):
    try:
        int(obj):
    except (TypeError, ValueError):
        raise TypeError('an float or integer is required')
History
Date User Action Args
2019-05-30 09:03:14Justin Faysetrecipients: + Justin Fay, eric.smith, cheryl.sabella, mangrisano
2019-05-30 09:03:14Justin Faysetmessageid: <1559206994.89.0.455382336788.issue37086@roundup.psfhosted.org>
2019-05-30 09:03:14Justin Faylinkissue37086 messages
2019-05-30 09:03:14Justin Faycreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.