equal
deleted
inserted
replaced
1 from __future__ import absolute_import, print_function |
1 from __future__ import absolute_import, print_function |
2 |
2 |
3 import sys |
3 import sys |
|
4 |
|
5 def flush(): |
|
6 sys.stdout.flush() |
|
7 sys.stderr.flush() |
4 |
8 |
5 globalvars = {} |
9 globalvars = {} |
6 lines = sys.stdin.readlines() |
10 lines = sys.stdin.readlines() |
7 while lines: |
11 while lines: |
8 l = lines.pop(0) |
12 l = lines.pop(0) |
13 while lines and lines[0].startswith('... '): |
17 while lines and lines[0].startswith('... '): |
14 l = lines.pop(0) |
18 l = lines.pop(0) |
15 snippet += l[4:] |
19 snippet += l[4:] |
16 c = compile(snippet, '<heredoc>', 'single') |
20 c = compile(snippet, '<heredoc>', 'single') |
17 try: |
21 try: |
|
22 flush() |
18 exec(c, globalvars) |
23 exec(c, globalvars) |
|
24 flush() |
19 except Exception as inst: |
25 except Exception as inst: |
|
26 flush() |
20 print(repr(inst)) |
27 print(repr(inst)) |