warn_shutdown.py does not emit warnings because the thread states are destroyed too late, when the modules have been destroyed.
I opened a new issue #19466 "Clear state of threads earlier in Python shutdown" which would permit to emit properly warnings, at least for the specific case of warn_shutdown.py.
> The changeset 1787277915e9 is closer to a workaround than a real fix: ...
If the module is None, it's too late: modules have been destroyed, so it's safer to not call warn_explicit() and do nothing.
I tested to fail with an assertion error if a warning is emitted too late (ie. when module is None). test_threading.test_4_daemon_threads() does fail in this case. Using the patch attached to #19466, the full test suite pass correctly.