Skip to content

QRect/TypeError regression introduced by PyQt5 version 5.15.7 #496

@crwood

Description

@crwood

After updating to PyQt5 version 5.15.7, it is possible for Gridsync's BadgedPixmap to throw TypeError as follows:

Traceback (most recent call last):
  File "/home/user/code/gridsync/gridsync/gui/main_window.py", line 305, in on_message_received
    self._maybe_show_news_message(gateway, title, message)
  File "/home/user/code/gridsync/gridsync/gui/main_window.py", line 294, in _maybe_show_news_message
    self.gui.systray.update()
  File "/home/user/code/gridsync/gridsync/gui/systray.py", line 65, in update
    BadgedPixmap(
  File "/home/user/code/gridsync/gridsync/gui/pixmap.py", line 61, in __init__
    rect = QRect(
TypeError: arguments did not match any overloaded call:
  QRect(): too many arguments                                                                                                                                                                                                                  
  QRect(int, int, int, int): argument 1 has unexpected type 'float'                                                                                                                                                                            
  QRect(QPoint, QPoint): argument 1 has unexpected type 'float'                                                                                                                                                                                
  QRect(QPoint, QSize): argument 1 has unexpected type 'float'                                                                                                                                                                                 
  QRect(QRect): argument 1 has unexpected type 'float'                                                                                                                                                                                         

The relevant code path shows that, depending on the size of the base image, BadgedPixmap can, indeed, pass a float to the QRect constructor, leading to the above error. Accordingly, these values should be cast to ints so as to avoid throwing a TypeError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions