-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: 'import pyface.tasks.api' fails with latest PySide6 #1163
Comments
Using >>> from pyface.qt import QtCore
>>> QtCore.Qt.DockWidgetArea.LeftDockWidgetArea
<DockWidgetArea.LeftDockWidgetArea: 1>
>>> int(QtCore.Qt.DockWidgetArea.LeftDockWidgetArea)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int() argument must be a string, a bytes-like object or a number, not 'DockWidgetArea'
>>> type(QtCore.Qt.DockWidgetArea.LeftDockWidgetArea).__mro__
(<enum 'DockWidgetArea'>, <enum 'Flag'>, <enum 'Enum'>, <class 'object'>)
>>> QtCore.Qt.DockWidgetArea.LeftDockWidgetArea.value
1 |
And this is indeed new with PySide6 6.4.0. With 6.3.2, I get: >>> from pyface.qt import QtCore
>>> int(QtCore.Qt.DockWidgetArea.LeftDockWidgetArea)
1
>>> QtCore.Qt.DockWidgetArea.LeftDockWidgetArea.value
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'PySide6.QtCore.Qt.DockWidgetArea' object has no attribute 'value'
>>> |
Looks like matplotlib ran into this too: matplotlib/matplotlib#24155 (fix in matplotlib/matplotlib#24158) |
This also begs the question about why we were casting to A bit of digging shows it was to work around a PySide 1.0 bug: #11 We can possibly remove all of the |
Yes, a solution that just treats all Qt Enum values as black-box immutable value objects and doesn't try to interpret them in any way sounds like the ideal fix. (But I could see situations where that wouldn't work - e.g., if we need to serialise and deserialise enum values for some reason.) |
Environment
OS: Mac
Python version: 3.8
Toolkit: Qt
Qt API: PySide6
Description
Importing
pyface.tasks.api
fails with the latest Pyface (7.4.2) from PyPI and the latest PySide6 (6.4.0).Steps to Reproduce
pip install pyface PySide6
pyface.tasks.api
.The result of the import is a traceback with tail end:
Here's the full session:
The text was updated successfully, but these errors were encountered: