[Python-checkins] cpython (merge 3.4 -> default): Broke reference loops in tests added in issue #5700.

serhiy.storchaka python-checkins at python.org
Sun Feb 22 23:33:58 CET 2015


https://hg.python.org/cpython/rev/a8df1ca60452
changeset:   94729:a8df1ca60452
parent:      94726:72cf174cc0eb
parent:      94728:00bde0743690
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Feb 23 00:31:33 2015 +0200
summary:
  Broke reference loops in tests added in issue #5700.

files:
  Lib/test/test_io.py |  3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -602,6 +602,7 @@
         self.assertTrue(f.closed)
         self.assertTrue(closed)      # flush() called
         self.assertFalse(closed[0])  # flush() called before file closed
+        f.flush = lambda: None  # break reference loop
 
     def test_flush_error_on_close(self):
         # raw file
@@ -829,6 +830,7 @@
         self.assertTrue(closed)      # flush() called
         self.assertFalse(closed[0])  # flush() called before file closed
         self.assertFalse(closed[1])
+        raw.flush = lambda: None  # break reference loop
 
     def test_close_error_on_close(self):
         raw = self.MockRawIO()
@@ -2731,6 +2733,7 @@
         self.assertTrue(closed)      # flush() called
         self.assertFalse(closed[0])  # flush() called before file closed
         self.assertFalse(closed[1])
+        txt.flush = lambda: None  # break reference loop
 
     def test_close_error_on_close(self):
         buffer = self.BytesIO(self.testdata)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list