https://github.com/python/cpython/commit/b7d62050e7d5fc208ae7673613da4f1f2bc565c4 commit: b7d62050e7d5fc208ae7673613da4f1f2bc565c4 branch: master author: Josh Snyder <hashbrowncipher at users.noreply.github.com> committer: Vinay Sajip <vinay_sajip at yahoo.co.uk> date: 2018年10月23日T07:48:38+01:00 summary: bpo-35046: do only one system call per line (logging.StreamHandler) (GH-10042) files: M Lib/logging/__init__.py diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 58afcd29c90a..b4659af7cc98 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1091,8 +1091,8 @@ def emit(self, record): try: msg = self.format(record) stream = self.stream - stream.write(msg) - stream.write(self.terminator) + # issue 35046: merged two stream.writes into one. + stream.write(msg + self.terminator) self.flush() except Exception: self.handleError(record)