mirror of
https://github.com/python/cpython.git
synced 2025-09-17 22:20:23 +00:00
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:
parent
b5120ceae2
commit
2d873bd68b
2 changed files with 28 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue