harvimt / quamash

Implementation of the PEP 3156 event-loop (asyncio) api using the Qt Event-Loop
BSD 2-Clause "Simplified" License
264 stars 46 forks source link

[python3.10] implicit float to int conversion #128

Open stanislavlevin opened 2 years ago

stanislavlevin commented 2 years ago

Many of quamash self-tests fail with similar traceback (checked with PyQt5):

quamash/__init__.py:344: in call_later
    return self._add_callback(asyncio.Handle(callback, args, self, context=context), d
elay)
quamash/__init__.py:348: in _add_callback
    return self._timer.add_callback(handle, delay)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <quamash._SimpleTimer object at 0x7f6a22308160>
handle = <Handle _QEventLoop.stop()>, delay = 0.1

    def add_callback(self, handle, delay=0):
>       timerid = self.startTimer(delay * 1000)
E    TypeError: startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer): argum
ent 1 has unexpected type 'float'
============== 21 failed, 24 passed, 2 warnings, 1 error in 2.70s ==============

According to https://docs.python.org/3.10/whatsnew/3.10.html#other-language-changes:

Builtin and extension functions that take integer arguments no longer accept Decimals, Fractions and other objects that can be converted to integers only with a loss (e.g. that have the int() method but do not have the index() method). (Contributed by Serhiy Storchaka in bpo-37999.)