[New-bugs-announce] [issue35707] time.sleep() should support objects with __float__

Jeroen Demeyer report at bugs.python.org
Thu Jan 10 10:58:39 EST 2019

New submission from Jeroen Demeyer <J.Demeyer at UGent.be>:

This used to work correctly in Python 2:

class Half(object):
    def __float__(self):
        return 0.5
import time

With Python 3.6, one gets instead

Traceback (most recent call last):
  File "test.py", line 6, in <module>
TypeError: an integer is required (got type Half)

messages: 333391
nosy: jdemeyer
priority: normal
severity: normal
status: open
title: time.sleep() should support objects with __float__
versions: Python 3.6, Python 3.7, Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list