Skip to content

Commit

Permalink
Check if stream is already closed
Browse files Browse the repository at this point in the history
  • Loading branch information
PGijsbers committed Dec 13, 2024
1 parent 98bf554 commit 622e86b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion amlb/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def new_print(*args, sep=" ", end=nl, file=None):
nonlocal buffer
buf_type = "err" if file is sys.stderr else "out"
buf = buffer[buf_type]
if buf is None:
if buf is None or buf.closed:
buf = buffer[buf_type] = io.StringIO()
line = sep.join(map(str, [*args]))
buf.write(line) # "end" newline always added by logger
Expand Down

0 comments on commit 622e86b

Please sign in to comment.