FS#73763 - [python-wxpython] Incompatible with python310

Attached to Project: Community Packages
Opened by Tomas (wereii) - Saturday, 12 February 2022, 17:47 GMT
Last edited by Morten Linderud (Foxboron) - Tuesday, 23 August 2022, 18:00 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Morten Linderud (Foxboron)
Filipe Laíns (FFY00)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
There was a change in python310 where (binary/C[++]) extension functions no longer silently accept non-integer arguments like floats.
Both, the current version of wxPython in repos and newest released version is not compatible with py310 but there are fixes available in wxPython master.

Additional info:
* package version(s)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:

```
import wx
from wx.lib.buttons import GenBitmapButton


def empty_bitmap():
data = bytearray((0,0,0))
alpha = bytearray((0,))
image = wx.Image(1, 1, data, alpha)
return image.ConvertToBitmap()

def onButton(event):
print("Pressed" )

app = wx.App()
frame = wx.Frame(None, -1, 'Test Frame')
frame.SetSize(0,0,100,100)

panel = wx.Panel(frame, wx.ID_ANY)
button = GenBitmapButton(panel, wx.ID_ANY, empty_bitmap())
button.Bind(wx.EVT_BUTTON, onButton)

frame.Show()
app.MainLoop()
```

This example should generate these errors from inside wxPython itself:

```
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/wx/lib/buttons.py", line 496, in OnPaint
self.DrawLabel(dc, width, height)
File "/usr/lib/python3.10/site-packages/wx/lib/buttons.py", line 847, in DrawLabel
dc.DrawBitmap(bmp, (width-bw)/2+dx, (height-bh)/2+dy, hasMask)
TypeError: DC.DrawBitmap(): arguments did not match any overloaded call:
overload 1: argument 2 has unexpected type 'float'
overload 2: argument 2 has unexpected type 'float'
```

One possible solution could be to backport this commit from master that fixes it:
https://github.com/wxWidgets/Phoenix/commit/173d0796810bb65de9bdfdc6941d24a04628f6c2

Currently affected packages (known to me) is only Pyfa from AUR.
Searching forums, it seems not many packages were hit by this (yet?).
This task depends upon

Closed by  Morten Linderud (Foxboron)
Tuesday, 23 August 2022, 18:00 GMT
Reason for closing:  Fixed
Comment by rainbow (rainbow) - Wednesday, 17 August 2022, 11:00 GMT
should be fixed with release 4.2.0

Loading...