MCPcopy Index your code
hub / github.com/bpython/bpython / flush

Method flush

bpython/repl.py:1077–1089  ·  view source on GitHub ↗

Olivier Grisel brought it to my attention that the logging module tries to call this method, since it makes assumptions about stdout that may not necessarily be true. The docs for sys.stdout say: "stdout and stderr needn't be built-in file objects: any objec

(self)

Source from the content-addressed store, hash-verified

1075 self.rl_history.entries = entries
1076
1077 def flush(self) -> None:
1078 """Olivier Grisel brought it to my attention that the logging
1079 module tries to call this method, since it makes assumptions
1080 about stdout that may not necessarily be true. The docs for
1081 sys.stdout say:
1082
1083 "stdout and stderr needn't be built-in file objects: any
1084 object is acceptable as long as it has a write() method
1085 that takes a string argument."
1086
1087 So I consider this to be a bug in logging, and this is a hack
1088 to fix it, unfortunately. I'm sure it's not the only module
1089 to do it."""
1090
1091 def close(self):
1092 """See the flush() method docstring."""

Callers 3

mainFunction · 0.45
outMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected