summary refs log tree commit diff
path: root/packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-06-02 11:03:44 +0200
committerRory& <root@rory.gay>2025-06-02 11:03:44 +0200
commit2f2f4d4ff56300dbc9838e37d20765e32b4e2714 (patch)
tree86ac630a97d327c92e571d7bec91b9fe5bec4b0c /packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch
parentFix server (diff)
downloadRory-Open-Architecture-desktop.tar.xz
desktop changes desktop
Diffstat (limited to 'packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch')
-rw-r--r--packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch75
1 files changed, 0 insertions, 75 deletions
diff --git a/packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch b/packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch
deleted file mode 100644

index 2530521..0000000 --- a/packages/overlays/matrix-synapse/patches/0050-Explain-why-we-flush_buffer-for-Python-print-.-outpu.patch +++ /dev/null
@@ -1,75 +0,0 @@ -From a3bbd7eeabee7c6b229e95e0e04af5b430ea32db Mon Sep 17 00:00:00 2001 -From: Eric Eastwood <erice@element.io> -Date: Tue, 13 May 2025 10:40:49 -0500 -Subject: [PATCH 50/74] Explain why we `flush_buffer()` for Python `print(...)` - output (#18420) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Spawning from using this code elsewhere and not knowing why it's there. - -Based on this article and @reivilibre's experience mentioning -`PYTHONUNBUFFERED=1`, - -> #### programming languages where the default “print” statement buffers -> -> Also, here are a few programming language where the default print -statement will buffer output when writing to a pipe, and some ways to -disable buffering if you want: -> -> - Python (disable with `python -u`, or `PYTHONUNBUFFERED=1`, or -`sys.stdout.reconfigure(line_buffering=False)`, or `print(x, -flush=True)`) -> -> _-- -https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-buffering/#programming-languages-where-the-default-print-statement-buffers_ ---- - changelog.d/18420.misc | 1 + - docker/configure_workers_and_start.py | 5 +++++ - docker/start.py | 5 +++++ - 3 files changed, 11 insertions(+) - create mode 100644 changelog.d/18420.misc - -diff --git a/changelog.d/18420.misc b/changelog.d/18420.misc -new file mode 100644 -index 0000000000..d52175af91 ---- /dev/null -+++ b/changelog.d/18420.misc -@@ -0,0 +1 @@ -+Explain why we `flush_buffer()` for Python `print(...)` output. -diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py -index df34d51f77..102a88fad1 100755 ---- a/docker/configure_workers_and_start.py -+++ b/docker/configure_workers_and_start.py -@@ -352,6 +352,11 @@ def error(txt: str) -> NoReturn: - - - def flush_buffers() -> None: -+ """ -+ Python's `print()` buffers output by default, typically waiting until ~8KB -+ accumulates. This method can be used to flush the buffers so we can see the output -+ of any print statements so far. -+ """ - sys.stdout.flush() - sys.stderr.flush() - -diff --git a/docker/start.py b/docker/start.py -index 818a5355ca..0be9976a0c 100755 ---- a/docker/start.py -+++ b/docker/start.py -@@ -22,6 +22,11 @@ def error(txt: str) -> NoReturn: - - - def flush_buffers() -> None: -+ """ -+ Python's `print()` buffers output by default, typically waiting until ~8KB -+ accumulates. This method can be used to flush the buffers so we can see the output -+ of any print statements so far. -+ """ - sys.stdout.flush() - sys.stderr.flush() - --- -2.49.0 -