[pypy-svn] pypy default: Finally found why these tests were blocking in pypy.
amauryfa
commits-noreply at bitbucket.org
Tue Jan 25 16:25:26 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r41299:c1a2ac377ca4
Date: 2011-01-25 16:24 +0100
http://bitbucket.org/pypy/pypy/changeset/c1a2ac377ca4/
Log: Finally found why these tests were blocking in pypy. 3 issues, one
'fix'...
diff --git a/lib-python/modified-2.7.0/test/test_io.py b/lib-python/modified-2.7.0/test/test_io.py
--- a/lib-python/modified-2.7.0/test/test_io.py
+++ b/lib-python/modified-2.7.0/test/test_io.py
@@ -2516,6 +2516,31 @@
def check_interrupted_write(self, item, bytes, **fdopen_kwargs):
"""Check that a partial write, when it gets interrupted, properly
invokes the signal handler."""
+
+ # XXX This test has three flaws that appear when objects are
+ # XXX not reference counted.
+
+ # - if wio.write() happens to trigger a garbage collection,
+ # the signal exception may be raised when some __del__
+ # method is running; it will not reach the assertRaises()
+ # call.
+
+ # - more subtle, if the wio object is not destroyed at once
+ # and survives this function, the next opened file is likely
+ # to have the same fileno (since the file descriptor was
+ # actively closed). When wio.__del__ is finally called, it
+ # will close the other's test file... To trigger this with
+ # CPython, try adding "global wio" in this function.
+
+ # - This happens only for streams created by the _pyio module,
+ # because a wio.close() that fails still consider that the
+ # file needs to be closed again. You can try adding an
+ # "assert wio.closed" at the end of the function.
+
+ # Fortunately, a little gc.gollect() seems to be enough to
+ # work around all these issues.
+ support.gc_collect()
+
read_results = []
def _read():
s = os.read(r, 1)
More information about the Pypy-commit
mailing list