[Python-checkins] cpython: Issue #12400: test_faulthandler now uses sys.__stderr__

victor.stinner python-checkins at python.org
Wed Jun 29 23:26:31 CEST 2011


http://hg.python.org/cpython/rev/c7bed90e4f31
changeset: 71083:c7bed90e4f31
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed Jun 29 23:24:31 2011 +0200
summary:
 Issue #12400: test_faulthandler now uses sys.__stderr__
instead of open(os.devnull, 'w')
files:
 Lib/test/test_faulthandler.py | 6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -231,14 +231,12 @@
 self.assertNotEqual(exitcode, 0)
 
 def test_is_enabled(self):
- null_stderr = None
 orig_stderr = sys.stderr
 try:
 # regrtest may replace sys.stderr by io.StringIO object, but
 # faulthandler.enable() requires that sys.stderr has a fileno()
 # method
- null_stderr = open(os.devnull, 'w')
- sys.stderr = null_stderr
+ sys.stderr = sys.__stderr__
 
 was_enabled = faulthandler.is_enabled()
 try:
@@ -253,8 +251,6 @@
 faulthandler.disable()
 finally:
 sys.stderr = orig_stderr
- if null_stderr is not None:
- null_stderr.close()
 
 def check_dump_traceback(self, filename):
 """
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /