[New-bugs-announce] [issue39851] tarfile: Exception ignored in (... stdout ...) BrokenPipeError

STINNER Victor report at bugs.python.org
Wed Mar 4 13:03:06 EST 2020


New submission from STINNER Victor <vstinner at python.org>:

When a stdout pipe is closed on the consumer side, Python logs an exception at exit:

$ ./python -m tarfile -l archive.tar|true
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

I tried to flush explicitly stdout at exit: it allows to catch BrokenPipeError... but Python still logs the exception, since it triggered by the TextIOWrapper finalizer which tries to flush the file again.

See also bpo-39828: "json.tool should catch BrokenPipeError".

----------
components: Library (Lib)
messages: 363368
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: tarfile: Exception ignored in (... stdout ...) BrokenPipeError
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39851>
_______________________________________


More information about the New-bugs-announce mailing list