Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72c5c77

Browse files
author
Samuele Pedroni
committed
minor fix, jython-only. Don't asssume stdout to save is the ur-stdout.
1 parent a98924a commit 72c5c77

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/test/test_codeop.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ def assertValid(self, str, symbol='single'):
2626
self.assert_(code)
2727
if symbol == "single":
2828
d,r = {},{}
29+
saved_stdout = sys.stdout
2930
sys.stdout = cStringIO.StringIO()
3031
try:
3132
exec code in d
3233
exec compile(str,"<input>","single") in r
3334
finally:
34-
sys.stdout = sys.__stdout__
35+
sys.stdout = saved_stdout
3536
elif symbol == 'eval':
3637
ctx = {'a': 2}
3738
d = { 'value': eval(code,ctx) }

0 commit comments

Comments
 (0)