Skip to content
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

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

Open
stanislavlevin opened this issue Mar 21, 2022 · 0 comments · May be fixed by #129
Open

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

stanislavlevin opened this issue Mar 21, 2022 · 0 comments · May be fixed by #129

Comments

@stanislavlevin
Copy link

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.)

stanislavlevin added a commit to stanislavlevin/quamash that referenced this issue Mar 21, 2022
As of Python3.10:
> 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.)

`startTimer` accepts only integers (milliseconds) and fails to
implicitly convert floats.

Fixes: harvimt#128
Signed-off-by: Stanislav Levin <[email protected]>
@stanislavlevin stanislavlevin linked a pull request Mar 21, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant