New submission from Josh Snyder <hashbrowncip...@gmail.com>:
logging.StreamHandler contains the following code: stream.write(msg) stream.write(self.terminator) stream.flush() When sys.stderr (or whatever other stream) is unbuffered, this results in two system calls and allows log records from different processes to concatenate on the same line in the output stream (followed by multiple newlines). This issue is new in Python 3.7, as stdout and stderr became "truly unbuffered" (cf. #30404). As a simple solution, I believe the following would fix the issue and also be backward compatible: stream.write(msg + self.terminator) stream.flush() ---------- messages: 328269 nosy: josnyder priority: normal severity: normal status: open title: logging.StreamHandler performs two syscalls when one would do type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35046> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com