classification
Title: Flush file after warning is written
Type: behavior Stage: patch review
Components: IO Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: mjacob
Priority: normal Keywords: patch

Created on 2020-06-20 12:34 by mjacob, last changed 2020-09-27 00:06 by iritkatriel.

Pull Requests
URL Status Linked Edit
PR 21000 open mjacob, 2020-06-20 12:39
Messages (1)
msg371934 - (view) Author: Manuel Jacob (mjacob) * Date: 2020-06-20 12:34
Calling warnings.warn() will write to a file, but not flush it. On Python 3.9+, it won’t usually be a problem because the file is most likely stderr, which is always line-buffered. However, on older Python versions or if a different file is used, the current behavior unnecessarily delays the output of the warning. This is especially problematic if the warning is about buffering behavior itself, as e.g. caused by `open('/tmp/test', 'wb', buffering=1)`.
History
Date User Action Args
2020-09-27 00:06:07iritkatrielsettype: behavior
components: + IO
2020-06-20 12:39:37mjacobsetkeywords: + patch
stage: patch review
pull_requests: + pull_request20175
2020-06-20 12:34:37mjacobcreate