terminalwriter: don't flush implicitly; add explicit flushes
Flushing on every write is somewhat expensive. Rely on line buffering instead (if line buffering for stdout is disabled, there must be some reason...), and add explicit flushes when not outputting lines. This is how regular `print()` e.g. work so should be familiar.
This commit is contained in:
@@ -1424,7 +1424,7 @@ def _showfixtures_main(config, session):
|
||||
|
||||
def write_docstring(tw: TerminalWriter, doc: str, indent: str = " ") -> None:
|
||||
for line in doc.split("\n"):
|
||||
tw.write(indent + line + "\n")
|
||||
tw.line(indent + line)
|
||||
|
||||
|
||||
class Function(PyobjMixin, nodes.Item):
|
||||
|
||||
Reference in New Issue
Block a user