◐ Shell
clean mode source ↗

Message 352427 - Python tracker

I've also seen these occasionally, but I haven't yet found a way to reproduce consistently.

Regardless, IMO the shutdown close() and _close() should be the places handling shutdown-related exceptions if possible.  In all of the tracebacks posted here, as well as those in #35263 and #17822, one such method is in the call chain, and it could simply catch and handle the raised exception.

I also think these are clear improvements that are safe to include, even without understanding the full details of the sequences of events leading to the errors.