Issue #23016: A warning no longer produces an AttributeError when sys.stderr
is None.