[Python-checkins] cpython (merge default -> default): merge heads

benjamin.peterson python-checkins at python.org
Thu Jun 30 05:53:57 CEST 2011


http://hg.python.org/cpython/rev/c3b487048a0f
changeset:   71088:c3b487048a0f
parent:      71087:151142c0c5b1
parent:      71085:6edb7c153105
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Jun 29 22:53:19 2011 -0500
summary:
  merge heads

files:
  Lib/test/test_cprofile.py |  23 +++++++++++++----------
  1 files changed, 13 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_cprofile.py b/Lib/test/test_cprofile.py
--- a/Lib/test/test_cprofile.py
+++ b/Lib/test/test_cprofile.py
@@ -18,16 +18,19 @@
     def test_bad_counter_during_dealloc(self):
         import _lsprof
         # Must use a file as StringIO doesn't trigger the bug.
-        with open(TESTFN, 'w') as file:
-            sys.stderr = file
-            try:
-                obj = _lsprof.Profiler(lambda: int)
-                obj.enable()
-                obj = _lsprof.Profiler(1)
-                obj.disable()
-            finally:
-                sys.stderr = sys.__stderr__
-        unlink(TESTFN)
+        orig_stderr = sys.stderr
+        try:
+            with open(TESTFN, 'w') as file:
+                sys.stderr = file
+                try:
+                    obj = _lsprof.Profiler(lambda: int)
+                    obj.enable()
+                    obj = _lsprof.Profiler(1)
+                    obj.disable()
+                finally:
+                    sys.stderr = orig_stderr
+        finally:
+            unlink(TESTFN)
 
 
 def test_main():

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


More information about the Python-checkins mailing list