Skip to content

Commit

Permalink
fix stderr/stdout missing flush()
Browse files Browse the repository at this point in the history
- closes tqdm#1248
- re-fixes tqdm#1177
  • Loading branch information
casperdcl authored Mar 23, 2022
2 parents 2527b35 + c61a567 commit 165a23a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tqdm/std.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ def status_printer(file):
fp = file
fp_flush = getattr(fp, 'flush', lambda: None) # pragma: no cover
if fp in (sys.stderr, sys.stdout):
sys.stderr.flush()
sys.stdout.flush()
getattr(sys.stderr, 'flush', lambda: None)()
getattr(sys.stdout, 'flush', lambda: None)()

def fp_write(s):
fp.write(_unicode(s))
Expand Down Expand Up @@ -1455,7 +1455,7 @@ def set_postfix_str(self, s='', refresh=True):
def moveto(self, n):
# TODO: private method
self.fp.write(_unicode('\n' * n + _term_move_up() * -n))
self.fp.flush()
getattr(self.fp, 'flush', lambda: None)()

@property
def format_dict(self):
Expand Down

0 comments on commit 165a23a

Please sign in to comment.