New submission from STINNER Victor:

The Popen.communicate() method ignores broken pipe error when writing to stdin. 
I propose to modify Popen.__exit__() to do the same in Python 3.5.

Attached patch implements this suggestion and document it. I added this 
paragraph to Popen doc:

"The context manager ignores broken pipe errors when closing the process’s 
stdin: call explicitly proc.stdin.flush() and proc.stdin.close() to get broken 
pipe errors."

So it's still possible to get broken pipe errors if you need them.

Do you know applications or libraries which rely on broken pipe errors and do 
something different than just ignoring them?

I prefer to leave Python 3.4 unchanged to avoid subtle behaviour changes in 
minor Python releases.

See also:

- issue #21619 which modified Popen.__exit__() to call wait() even if 
stdin.close() raised an exception
- issue #19612 which modified communicate() to handle EINVAL on stdin.write() 
on Windows

----------
files: popen_exit.patch
keywords: patch
messages: 237115
nosy: haypo, serhiy.storchaka, vadmium
priority: normal
severity: normal
status: open
title: Change "with subprocess.Popen():" (context manager) to ignore broken 
pipe error
versions: Python 3.5
Added file: http://bugs.python.org/file38311/popen_exit.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23570>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to