comparison Lib/code.py @ 7097:00a85ab0337f legacy-trunk

Seems I've found a way to fix this.
author Guido van Rossum <guido@python.org>
date Wed, 14 Jan 1998 15:40:30 +0000
parents 644484e1a37b
children fb4b4d069cc7
comparison
equal deleted inserted replaced
7096:5bb884527446 7097:00a85ab0337f
1 # XXX This is broken with class exceptions
2
3 """Utilities dealing with code objects.""" 1 """Utilities dealing with code objects."""
4 2
5 def compile_command(source, filename="<input>", symbol="single"): 3 def compile_command(source, filename="<input>", symbol="single"):
6 r"""Compile a command and determine whether it is incomplete. 4 r"""Compile a command and determine whether it is incomplete.
7 5
48 except SyntaxError, err2: 46 except SyntaxError, err2:
49 pass 47 pass
50 48
51 if code: 49 if code:
52 return code 50 return code
53 if not code1 and err1 == err2: 51 try:
52 e1 = err1.__dict__
53 except AttributeError:
54 e1 = err1
55 try:
56 e2 = err2.__dict__
57 except AttributeError:
58 e2 = err2
59 if not code1 and e1 == e2:
54 raise SyntaxError, err1 60 raise SyntaxError, err1
55 61
56 62
57 def interact(banner=None, readfunc=raw_input, local=None): 63 def interact(banner=None, readfunc=raw_input, local=None):
58 # Due to Jeff Epler, with changes by Guido: 64 # Due to Jeff Epler, with changes by Guido: