Float to int conversion in Qt and Python 3.10 on Fedora 35 beta

Bug #1946407 reported by yodatak
84
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Rapid Photo Downloader
Fix Released
Critical
Damon Lynch

Bug Description

When runing the one in fedora packages i got this crash with this error:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/raphodo/rapid.py", line 862, in initStage4
    self.temporalProximity = TemporalProximity(rapidApp=self, prefs=self.prefs)
  File "/usr/lib/python3.10/site-packages/raphodo/proximity.py", line 1835, in __init__
    self.temporalValuePicker = TemporalValuePicker(self.prefs.get_proximity())
  File "/usr/lib/python3.10/site-packages/raphodo/proximity.py", line 1742, in __init__
    self.display.setFixedWidth(width + 6)
TypeError: setFixedWidth(self, int): argument 1 has unexpected type 'float'

Related branches

Revision history for this message
Damon Lynch (dlynch3) wrote (last edit ):

Thanks for this bug report, which I can easily replicate. In pretty sure it's a bug in Fedora's Python 3.10 auto conversion of float to int when calling Qt, but nonetheless I've fixed it. I plan to release 0.9.27a3 with this fix within a few hours.

Unfortunately, however, that brings us to an equally serious bug when using Python's pickle:

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

That's a problem outside the scope of Rapid Photo Downloader. It's a problem in the implementation of Python in Fedora. Until it is fixed Rapid Photo Downloader simply will not work. It probably should be reported in Fedora. Are you feel confident to do that? Probably it will be best to replicate it on your own system after I make the 0.9.27a3 release.

Changed in rapid:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Damon Lynch (dlynch3)
milestone: none → 0.9.27a3
Damon Lynch (dlynch3)
summary: - Crash at start in fedora 35 Python 3.10
+ Float to int conversion in Qt and Python 3.10 on Fedora 35 beta
Damon Lynch (dlynch3)
Changed in rapid:
status: In Progress → Fix Committed
Revision history for this message
Damon Lynch (dlynch3) wrote :

Please let me know if you encounter the same bug in any other place in the code. I think I got them all, but may not have.

Changed in rapid:
status: Fix Committed → Fix Released
Revision history for this message
yodatak (mryodatak) wrote :

Hi i got this issue now the app start but the copy does weird things like this bug :

"Traceback (most recent call last):
  File "/home/yodatak/.local/lib/python3.10/site-packages/raphodo/thumbnaildisplay.py", line 2224, in paint
    painter.drawPixmap(
TypeError: arguments did not match any overloaded call:
  drawPixmap(self, QRectF, QPixmap, QRectF): argument 1 has unexpected type 'float'
  drawPixmap(self, QRect, QPixmap, QRect): argument 1 has unexpected type 'float'
  drawPixmap(self, Union[QPointF, QPoint], QPixmap): argument 1 has unexpected type 'float'
  drawPixmap(self, QPoint, QPixmap): argument 1 has unexpected type 'float'
  drawPixmap(self, QRect, QPixmap): argument 1 has unexpected type 'float'
  drawPixmap(self, int, int, QPixmap): argument 1 has unexpected type 'float'
  drawPixmap(self, int, int, int, int, QPixmap): argument 1 has unexpected type 'float'
  drawPixmap(self, int, int, int, int, QPixmap, int, int, int, int): argument 1 has unexpected type 'float'
  drawPixmap(self, int, int, QPixmap, int, int, int, int): argument 1 has unexpected type 'float'
  drawPixmap(self, Union[QPointF, QPoint], QPixmap, QRectF): argument 1 has unexpected type 'float'
  drawPixmap(self, QPoint, QPixmap, QRect): argument 1 has unexpected type 'float'

Revision history for this message
Damon Lynch (dlynch3) wrote :

Bummer. Looks like I missed that one. It's the same problem. Python 3.10 doesn't handle float to int conversion like previous versions.

Changed in rapid:
status: Fix Released → In Progress
Revision history for this message
Damon Lynch (dlynch3) wrote :

The fix is literally one line, but I'm still seeing the other issue with pickle.dumps() failing in the thumbnail extractors. It's difficult to test in other distros because I don't know of another distro that already uses Python 3.10. Arch, Debian, openSUSE, Ubuntu devel are all still on 3.9.x.

Revision history for this message
Damon Lynch (dlynch3) wrote :

Okay more progress, it seems the pickle.dumps() problem can be replicated like this, using Python 3.10:

>>> from PyQt5.QtCore import QByteArray
>>> import pickle
>>> pickle.dumps(QByteArray(b"test"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Revision history for this message
yodatak (mryodatak) wrote :

Some problem similar to this error on gnome https://gitlab.gnome.org/GNOME/libxml2/-/issues/203

Revision history for this message
yodatak (mryodatak) wrote :

Its seem to be in the porting guide of Python 3.10 https://docs.python.org/3.10/whatsnew/3.10.html#id2

Revision history for this message
Damon Lynch (dlynch3) wrote :

The PyQt developer has just confirmed he fixed the bug in both PyQt5 and sip. I'll file a bug report in Fedora within the next 24 hours.

Revision history for this message
yodatak (mryodatak) wrote :

I got this bug already open if needed :
https://bugzilla.redhat.com/show_bug.cgi?id=2012018

Revision history for this message
Damon Lynch (dlynch3) wrote :

Thanks for that bug report on Fedora. I'll file a separate one for PyQt/sip because it's a different bug.

Revision history for this message
Damon Lynch (dlynch3) wrote :

Added an issue in GitHub for the PyQt5 bug: https://github.com/damonlynch/rapid-photo-downloader/issues/37

Damon Lynch (dlynch3)
Changed in rapid:
status: In Progress → Fix Committed
Revision history for this message
Damon Lynch (dlynch3) wrote :

Fix released in 0.9.27b1.

Changed in rapid:
milestone: 0.9.27a3 → none
status: Fix Committed → Fix Released
Revision history for this message
yodatak (mryodatak) wrote :

Hi not sure if its linked but at the end of the transfer i got this error:

Traceback (most recent call last):
  File "/home/yodatak/.local/lib/python3.10/site-packages/raphodo/devicedisplay.py", line 1095, in paint
    self.deviceDisplay.paint_header(
  File "/home/yodatak/.local/lib/python3.10/site-packages/raphodo/devicedisplay.py", line 922, in paint_header
    painter.drawPixmap(x + self.padding, y + self.downloaded_icon_y, pixmap)
TypeError: arguments did not match any overloaded call:
  drawPixmap(self, QRectF, QPixmap, QRectF): argument 1 has unexpected type 'int'
  drawPixmap(self, QRect, QPixmap, QRect): argument 1 has unexpected type 'int'
  drawPixmap(self, Union[QPointF, QPoint], QPixmap): argument 1 has unexpected type 'int'
  drawPixmap(self, QPoint, QPixmap): argument 1 has unexpected type 'int'
  drawPixmap(self, QRect, QPixmap): argument 1 has unexpected type 'int'
  drawPixmap(self, int, int, QPixmap): argument 2 has unexpected type 'float'
  drawPixmap(self, int, int, int, int, QPixmap): argument 2 has unexpected type 'float'
  drawPixmap(self, int, int, int, int, QPixmap, int, int, int, int): argument 2 has unexpected type 'float'
  drawPixmap(self, int, int, QPixmap, int, int, int, int): argument 2 has unexpected type 'float'
  drawPixmap(self, Union[QPointF, QPoint], QPixmap, QRectF): argument 1 has unexpected type 'int'
  drawPixmap(self, QPoint, QPixmap, QRect): argument 1 has unexpected type 'int'

Revision history for this message
yodatak (mryodatak) wrote :

Same with doOpenInFileManagerAct
ERROR An unhandled exception occurred
ERROR Traceback (most recent call last):
  File "/home/yodatak/.local/lib/python3.10/site-packages/raphodo/thumbnaildisplay.py", line 1995, in doOpenInFileManagerAct
    if self.clickedIndex not in selectedIndexes:
TypeError: argument of type 'NoneType' is not iterable

Revision history for this message
Damon Lynch (dlynch3) wrote :

The "unexpected type 'int'" or "'float'" is related, but "argument of type 'NoneType' is not iterable" is a different issue.

Changed in rapid:
status: Fix Released → In Progress
Damon Lynch (dlynch3)
Changed in rapid:
milestone: none → 0.9.27b2
Damon Lynch (dlynch3)
Changed in rapid:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.