Opened 2 years ago

Closed 2 years ago

#9508 closed defect (fixed)

TypeError setting framerate

Reported by: Zach Pearson Owned by: Zach Pearson
Priority: low Milestone:
Component: UI Version:
Keywords: Cc: Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Just another one of these Python 3.11-no-longer-does-type-coercion bugs

File "/Users/zjp/git/rbvi/ChimeraX/src/bundles/core/src/updateloop.py", line 115, in set_redraw_interval

t.start(self.redraw_interval)

TypeError: arguments did not match any overloaded call:

start(self, msec: int): argument 1 has unexpected type 'float'
start(self): too many arguments

Could just truncate redraw_interval with int(redraw_interval) here. Tom if you agree I'll make the change

Change History (6)

comment:1 by Eric Pettersen, 2 years ago

Could also use round() instead of int().

--Eric


comment:2 by Tom Goddard, 2 years ago

What did the implicit casting from float to int in Python 3.9 do? I'd suggest doing the same as what the implicit cast did to maintain compatible behavior with the past.

comment:3 by Zach Pearson, 2 years ago

I think https://bugs.python.org/issue37999 implies int() is the equivalent instead of round() because the underlying method was int() and the bug title is 'No longer use implicit convertion to int with loss'. I think loss means truncate here.

comment:4 by Tom Goddard, 2 years ago

Testing in ChimeraX 1.6 shows timer.start(0.9) results in timer.interval() = 0. So cast to int is the right behavior.

comment:6 by Zach Pearson, 2 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.