diff options
author | Guido van Rossum <guido@python.org> | 2007-01-10 16:19:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-01-10 16:19:56 (GMT) |
commit | b940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch) | |
tree | 0b9ea19eba1e665dac95126c3140ac2bc36326ad /Demo/pysvr | |
parent | 893523e80a2003d4a630aafb84ba016e0070cbbd (diff) | |
download | cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2 |
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V"
(b) V is now limited to a simple name (local variable)
(c) V is now deleted at the end of the except block
Diffstat (limited to 'Demo/pysvr')
-rwxr-xr-x | Demo/pysvr/pysvr.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Demo/pysvr/pysvr.py b/Demo/pysvr/pysvr.py index 3b692b3..b1b7565 100755 --- a/Demo/pysvr/pysvr.py +++ b/Demo/pysvr/pysvr.py @@ -21,14 +21,14 @@ def main(): opts, args = getopt.getopt(sys.argv[1:], "") if len(args) > 1: raise getopt.error, "Too many arguments." - except getopt.error, msg: + except getopt.error as msg: usage(msg) for o, a in opts: pass if args: try: port = string.atoi(args[0]) - except ValueError, msg: + except ValueError as msg: usage(msg) else: port = PORT @@ -83,7 +83,7 @@ def run_interpreter(stdin, stdout): source = source + line try: code = compile_command(source) - except SyntaxError, err: + except SyntaxError as err: source = "" traceback.print_exception(SyntaxError, err, None, file=stdout) continue @@ -92,7 +92,7 @@ def run_interpreter(stdin, stdout): source = "" try: run_command(code, stdin, stdout, globals) - except SystemExit, how: + except SystemExit as how: if how: try: how = str(how) @@ -109,7 +109,7 @@ def run_command(code, stdin, stdout, globals): sys.stdin = stdin try: exec(code, globals) - except SystemExit, how: + except SystemExit as how: raise SystemExit, how, sys.exc_info()[2] except: type, value, tb = sys.exc_info() |