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.
This commit is contained in:
Jeffrey Yasskin 2008-12-08 18:55:24 +00:00
parent b5120ceae2
commit 2d873bd68b
2 changed files with 28 additions and 3 deletions

View file

@ -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.