Commit 209bf995 authored by Jason Madden's avatar Jason Madden

Catch a rare, racy error on PyPy subprocess.

parent 34cfd648
......@@ -27,7 +27,7 @@ version_info = _version_info(1, 5, 0, 'dev', 0)
#: Use ``pkg_resources.parse_version(__version__)`` or
#: ``packaging.version.Version(__version__)`` to get a machine-usable
#: value.
__version__ = '1.4.1.dev0'
__version__ = '1.5.0.dev0'
__all__ = [
......
......@@ -1503,10 +1503,20 @@ class Popen(object):
errpipe_read = FileObject(errpipe_read, 'rb')
data = errpipe_read.read()
finally:
try:
if hasattr(errpipe_read, 'close'):
errpipe_read.close()
else:
os.close(errpipe_read)
except OSError:
# Especially on PyPy, we sometimes see the above
# `os.close(errpipe_read)` raise an OSError.
# It's not entirely clear why, but it happens in
# InterprocessSignalTests.test_main sometimes, which must mean
# we have some sort of race condition.
pass
finally:
errpipe_read = -1
if data != b"":
self.wait()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment