Details
Description
Steps to reproduce
pip install openai
- Run pyside2310.py
- Enter text, press <Enter>
- Actual: crash after a while
- Expected: Exeption openai.error.AuthenticationError is immediately reported on stderr
I got it this problem with all my projects that uses QThreadPool and QRunnable objects, when an exception raises inside a QRunnable, the app stops responding for a while and then it crashes with no error trackback, and I just get "Process finished with exit code -1073741819 (0xC0000005)".
And this happens even in a normal terminal without an IDE, and it turns out that this problem totally goes away when I downgraded to PySide6 v6.4.2, I included a sample that suffers from this problem, open it and write anything in the box and hit enter.
Inside "ChatGPTGUI" class, in "eventFilter" function and in "thread" function, the line:-
completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=self.chatgpt_buffer)
Will raise an exception because the API key is wrong, in PySide6 v6.4.3 or higher, the app will crash as I mentioned, but in version PySide6 v6.4.2, it will report the exception normally in the terminal without crashing.
Also I noticed a big speed boost all functions that was called with QRunnables when I downgraded to PySide6 v6.4.2 in my projects, this issue is critical and it's not easy to notice unless someone was missing with old versions, specially the speed problem, I noticed it by luck.
In the file I included, the problem is visible here but it can be caught if the app got launched in a debugger, I have other more extreme cause where even the debugger can't catch the errors, but it a very big project and I can't imagine how I will minimize it yet, but I wish this sample I uploaded is sufficient to track down the problem.
Attachments
Issue Links
- relates to
-
PYSIDE-2321 Exceptions raised from event handlers cause the traceback module to crash
- Closed
-
PYSIDE-2160 QEnum does not work with QML properties
- Closed
-
PYSIDE-1889 Setting attribute to certain values on QWidget after it's hidden/shown causes error on future hide/shows with true_property enabled
- Closed
For Gerrit Dashboard: PYSIDE-2310 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
477692,3 | WIP: shiboken: Handle the printing of unraisable Exceptions in threads | dev | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
478161,2 | shiboken: Fix an unused variable warning | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
478174,2 | shiboken: Fix an unused variable warning | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
478729,2 | Shiboken: Undo the unraisable exception delay for now | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
478804,2 | Shiboken: Undo the unraisable exception delay for now | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
479761,13 | shiboken: Implement raising of unraisable exceptions correctly | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
482278,2 | shiboken: Implement raising of unraisable exceptions correctly | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |