New submission from STINNER Victor <vstin...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue39851>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to