diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-12-10 17:23:20 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-12-10 17:23:20 +0000 |
commit | 6f5d3f326f8c98dc4c53b422a92306e391e83cc2 (patch) | |
tree | b7d730cf288f7c8160b68f6cc1085b4b83043d22 /Lib/test/test_file.py | |
parent | 6f63190ded3ceea7a66a41b5a48c6c4541372def (diff) | |
download | cpython-git-6f5d3f326f8c98dc4c53b422a92306e391e83cc2.tar.gz |
Backport issue 4597 to python 2.5.3: Fixed several opcodes that weren't always
propagating exceptions.
Diffstat (limited to 'Lib/test/test_file.py')
-rw-r--r-- | Lib/test/test_file.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index 0a8114a0c7..ba6ea47edf 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -341,6 +341,20 @@ class StdoutTests(unittest.TestCase): finally: sys.stdout = save_stdout + def test_del_stdout_before_print(self): + # Issue 4597: 'print' with no argument wasn't reporting when + # sys.stdout was deleted. + save_stdout = sys.stdout + del sys.stdout + try: + print + except RuntimeError, e: + self.assertEquals(str(e), "lost sys.stdout") + else: + self.fail("Expected RuntimeError") + finally: + sys.stdout = save_stdout + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. |