Phoenix
Phoenix copied to clipboard
wx.RealPoint can't be created from immutable wx.RealPoint
Operating system: wxPython version & source: 4.1.2a1 gtk3 (phoenix) wxWidgets 3.1.5 Python version & source: 3.10.0
Description of the problem: wx.RealPoint can't be created from an immutable wx.RealPoint. This was noticed while trying to get all unittests working with current master. The reason this happens is that the wx.RealPoint(wx.Point) constructor gets called in this case. Its not immediately clear how to solve this, so I'm just going to make the unittest as xfail.
Code Example (click to expand)
import wx
obj = wx.RealPoint(1.2, 3.2)
im = obj.GetIM()
obj2 = wx.RealPoint(im)
print(obj2)
(-1.0, -1.0)
I tested with wx 4.1.1/Python 3.8.6 on Windows 10 The results are different from those obtained on Linux (possibly including OSX), but the decimal point is unexpectedly truncated. cf. (https://docs.wxpython.org/wx.RealPoint.html?highlight=wx%20realpoint#wx.RealPoint.GetIM)
>>> obj = wx.RealPoint(1.2, 3.2)
>>> obj
wx.RealPoint(1.2, 3.2)
>>> im = obj.GetIM()
>>> im
_im_RealPoint(x=1.2, y=3.2)
>>> obj2 = wx.RealPoint(im)
<input>:1: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
>>> obj2
wx.RealPoint(1.0, 3.0) # !! The decimal point is truncated.
>>> print(obj2)
(1.0, 3.0)