Qqwy / rust-pyO3-logger_swallos_exceptions

Minimal reproducible example of PyO3-logger not being exception-friendly

Repository from Github https://github.comQqwy/rust-pyO3-logger_swallos_exceptionsRepository from Github https://github.comQqwy/rust-pyO3-logger_swallos_exceptions

Minimal example of PyO3-logger swallowing exceptions

To reproduce:

source .venv/bin/activate
maturin develop
python example.py
# And press Ctrl+C partway through running it

Feel free to edit example.py to e.g. use sleepy=True rather than sleepy=False and change the log level.

The error

You get a nice Python stack trace:

^CTraceback (most recent call last):
  File "/usr/lib/python3.12/logging/__init__.py", line 1790, in isEnabledFor
    def isEnabledFor(self, level):

KeyboardInterrupt

but this exception is eaten rather than re-raising it. It is not available to py.check_signals() nor is it available to Python code after the Rust code returns.

About

Minimal reproducible example of PyO3-logger not being exception-friendly


Languages

Language:Rust 91.1%Language:Python 8.9%