[pypy-svn] r72943 - pypy/trunk/pypy/module/_file
arigo at codespeak.net
arigo at codespeak.net
Sat Mar 27 12:14:50 CET 2010
Author: arigo
Date: Sat Mar 27 12:14:48 2010
New Revision: 72943
Modified:
pypy/trunk/pypy/module/_file/__init__.py
Log:
Ignore I/O errors when flush()ing streams when the process
shuts down, instead of crashing with an RPython-level OSError.
Modified: pypy/trunk/pypy/module/_file/__init__.py
==============================================================================
--- pypy/trunk/pypy/module/_file/__init__.py (original)
+++ pypy/trunk/pypy/module/_file/__init__.py Sat Mar 27 12:14:48 2010
@@ -24,8 +24,8 @@
MixedModule.__init__(self, space, *args)
def shutdown(self, space):
- # at shutdown, flush all open streams
- from pypy.module._file.interp_file import getopenstreams
+ # at shutdown, flush all open streams. Ignore I/O errors.
+ from pypy.module._file.interp_file import getopenstreams, StreamErrors
openstreams = getopenstreams(space)
while openstreams:
for stream in openstreams.keys():
@@ -34,7 +34,10 @@
except KeyError:
pass # key was removed in the meantime
else:
- stream.flush()
+ try:
+ stream.flush()
+ except StreamErrors:
+ pass
def setup_after_space_initialization(self):
from pypy.module._file.interp_file import W_File
More information about the Pypy-commit
mailing list