summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_file.py
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@gmail.com>2008-12-08 18:55:24 (GMT)
committerJeffrey Yasskin <jyasskin@gmail.com>2008-12-08 18:55:24 (GMT)
commit2d873bd68b400e056e77790ca72cc7a7d8a5d07c (patch)
treee344b96c7be4aa694f49f3ffb510c32edb49f038 /Lib/test/test_file.py
parentb5120ceae2b323c0493f26136e820e8f5a5a5c45 (diff)
downloadcpython-2d873bd68b400e056e77790ca72cc7a7d8a5d07c.zip
cpython-2d873bd68b400e056e77790ca72cc7a7d8a5d07c.tar.gz
cpython-2d873bd68b400e056e77790ca72cc7a7d8a5d07c.tar.bz2
Issue 4597: Fix several cases in EvalFrameEx where an exception could be
"raised" without setting x, err, or why to let the eval loop know.
Diffstat (limited to 'Lib/test/test_file.py')
-rw-r--r--Lib/test/test_file.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index b93bdbd..2d791a5 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -531,6 +531,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 as 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.