-
Notifications
You must be signed in to change notification settings - Fork 716
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
Python 3.11 crashes in some cases when loguru.logger.exception called #775
Comments
Thank you for the report. If you ever find out which exception reproduces the problem, let me know. I know there were different changes in exception handling in Python 3.11 which are not yet unit tested by Loguru, I'll try to find out what can cause this. |
Managed to create a snippet which breaks
To build and run use
|
Thanks for the snippet, @gabus. Unfortunately, it seems I'm unable to reproduce the issue. |
Interesting! This is my setup:
Output is very vague. It just shows that worker died and new one has been spawned. Then in separate pop up python crash window appears asking action: Ignore, Restart or Close Pyhton.
|
I can reproduce it on macOS 13.1 with an M1 chip. The process terminted with a segmentation violation when reading loguru/loguru/_better_exceptions.py Line 182 in 16dbf79
|
I don't think it's a loguru's bug because accessing an instance attribute should never cause a core dump. (So maybe it's caused by Cython? I have tested with unCythonized falcon, and it works as expected.) |
Thanks @gabus and @xzmeng for the additional details. I tested on Linux but have no access to MacOS computer unfortunately. Are you both using Cython? |
I'm closing this issue as it likely not a Loguru bug (as shown by ticket linked above). 👍 |
I'm sorry as I can't provide example but after digging into code the only change which is needed
formatter_record["exception"] = "".join(lines)
change to
formatter_record["exception"] = "".join(str(lines))
in
loguru._handler.Handler.emit
it seems python 3.11 doesn't like implicit casting.
Though I'm second guessing my solution - don't know why it works..
The text was updated successfully, but these errors were encountered: