Skip to content

Commit

Permalink
tools: fix union-attr type-check errors in OutputRedirect class
Browse files Browse the repository at this point in the history
I'm very glad this is deprecated. The only reason I'm bothering to fix
this is because we can't remove it from the 8.0.x maintenance branch.
  • Loading branch information
dgw committed Aug 13, 2024
1 parent 04fca7a commit c8802f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sopel/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def write(self, string):
:param str string: the string to write
"""
if not self.quiet:
if not self.quiet and sys.__stderr__ and sys.__stdout__:
try:
if self.stderr:
sys.__stderr__.write(string)
Expand All @@ -179,9 +179,9 @@ def write(self, string):

def flush(self):
"""Flush the file writing buffer."""
if self.stderr:
if self.stderr and sys.__stderr__:
sys.__stderr__.flush()
else:
elif sys.__stdout__:
sys.__stdout__.flush()


Expand Down

0 comments on commit c8802f7

Please sign in to comment.