-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
PySide6 DeprecationWarning of exec_ #286
Comments
Thanks for the feedback @kumattau ! I think that the warning should be handled by the user application although maybe we should provide the mapping for Just in case, what do you think @ccordoba12 @CAM-Gerlach ? |
I think we should handle the DeprecationWarning because we're the ones calling |
I think we are not actually calling |
I found this DeprecationWarning in qtawesome/icon_broswer.py icon_browser.py imports QtPy, but this warning is generated from PySide6 because QtPy does nothing about exec_ of PySide6. |
I think if this DeprecationWarning should be handled by user application, exec_ function in the user application needs to be changed like as follows to avoid this warning and support PyQt5/PyQt6/PySide2/PySide6. # exec_ function is deprecated in PySide6
# Getting exec/exec_ and executing it is separated
# because executing exec/exec_ may propagates any exceptions.
try:
app_exec = app.exec
except AttributeError:
app_exec = app.exec_
sys.exit(app_exec()) |
Thanks for the clarification @kumattau ! I would say that then, with QtAwesome for example, we should do the corresponding changes there, but lets see what others say. From the QtPy part then as, I was thinking, maybe we should a similar mapping for |
I agree with @dalthviz ; "handling" the warning in QtPy would mean either dropping the shim functionality (which we deliberately added knowing this), or silencing the warning, meaning downstream code (like QtAwesome) won't know it has to update and will just suddenly break someday, so either doesn't really make sense. So, we can either simply pass the warning as we do now, or, if it doesn't raise backward compat concerns or have side effect on other users of the bindings (as in #26 ), map |
Thank @dalthviz @CAM-Gerlach @ccordoba12 for comment and explanation. I think this issue can be closed. |
As @dalthviz mentioned, we could consider aliasing the new names to the old ones, so user code doesn't need to implement try-excepts depending on the binding and version used; the goal of QtPy after all is a compatibility shim to abstract those differences so they don't need to be handled in every downstream application, and so ports to different bindings and upgrades to new versions is as seamless as possible (see #62 ). |
Thanks @kumattau !!
Would you like to help us with that @kumattau ? Let us know! |
Thank @CAM-Gerlach @dalthviz for more explanations. I'm sorry to misunderstand.
My current understanding is that, to be specific, user applications like as qtabrowser does not need to handle DeprecationWarning of exec_/print_ functions of PySide6 because the future QtPy release will provide exec_/print_ functions of PySide6 which does not report DeprecationWarning. Is my understanding correct ? I think the exec_/print_ functions is desirable to be provided in QtPy 2.0.0 release, which is going to support PySide6. |
Yep that will be the idea 👍 The thing is that right now we are only doing the mapping on PyQt6. So we still need to add the mapping (some lines like for example Sorry for not being so clear but let us know if you want to help with that or if you have any other question! |
I mistook about the The summary is as follows.
I think QtPy don't have to do anything about |
I sent PR: #287 to fix this issue. |
Thanks for your detailed research, @kumattau ! |
Hi,
exec_ function is deprecated in PySide6, so the common PyQt5/PySide2 code gets deprecated warning when QT_API=pyside6.
On the other hand, PyQt6 removes exec_ but QtPy provides exec_ for the compatibility. (#259)
As a result, DeprecationWarning of exec_ occurs only when QT_API=pyside6.
Which should this DeprecationWarning be addressed by QtPy or the user application?
Note that print_ function of PySide6 may have the same problem.
The text was updated successfully, but these errors were encountered: