Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a comment to explain why sys.stdout.write() is used
  • Loading branch information
vstinner committed May 25, 2026
commit 3a13b66b3eecc3b127309c9e10d635dfd125a9aa
2 changes: 2 additions & 0 deletions Lib/test/memory_watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def watchdog(pid):
# fail the same way.
return

# Prefer sys.stdout.write() to print() to use a single write() syscall.
# print(msg) calls write(msg.encode()) and then write(b"\n").
sys.stdout.write(f" ... process data size: {mem / ONE_GIB:.1f} GiB\n")
Comment thread
cmaloney marked this conversation as resolved.
sys.stdout.flush()
time.sleep(1)
Expand Down
Loading