[Python-checkins] cpython (2.7): 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/bf52f69d6948
changeset:   94727:bf52f69d6948
branch:      2.7
parent:      94722:15dd9d6cc632
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Feb 23 00:28:38 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
@@ -577,6 +577,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
@@ -786,6 +787,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()
@@ -2536,6 +2538,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_multi_close(self):
         txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")

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


More information about the Python-checkins mailing list