This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients corona10, vstinner
Date 2020-03-04.18:03:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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".
Date User Action Args
2020-03-04 18:03:06vstinnersetrecipients: + vstinner, corona10
2020-03-04 18:03:06vstinnersetmessageid: <>
2020-03-04 18:03:06vstinnerlinkissue39851 messages
2020-03-04 18:03:06vstinnercreate