If your program generates signals, it could generate a flood unintentionally. If you put a print statement in the handler, you can get this result.
It's not terribly surprising, but good to know.
Python or not, almost nothing is safe inside a signal handler.
The ones related to application logic must only be handled with signalfd if you want any semblance of reliability.
The C printf function is not async signal safe and is one of the examples in the manual: https://man7.org/linux/man-pages/man7/signal-safety.7.html