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
This commit is contained in:
Guido van Rossum 2007-01-10 16:19:56 +00:00
parent 893523e80a
commit b940e113bf
295 changed files with 817 additions and 743 deletions

View file

@ -110,7 +110,7 @@ def setup (**attrs):
# (ie. everything except distclass) to initialize it
try:
_setup_distribution = dist = klass(attrs)
except DistutilsSetupError, msg:
except DistutilsSetupError as msg:
if 'name' not in attrs:
raise SystemExit, "error in %s setup command: %s" % \
(attrs['name'], msg)
@ -135,7 +135,7 @@ def setup (**attrs):
# fault, so turn them into SystemExit to suppress tracebacks.
try:
ok = dist.parse_command_line()
except DistutilsArgError, msg:
except DistutilsArgError as msg:
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
if DEBUG:
@ -151,7 +151,7 @@ def setup (**attrs):
dist.run_commands()
except KeyboardInterrupt:
raise SystemExit, "interrupted"
except (IOError, os.error), exc:
except (IOError, os.error) as exc:
error = grok_environment_error(exc)
if DEBUG:
@ -161,7 +161,7 @@ def setup (**attrs):
raise SystemExit, error
except (DistutilsError,
CCompilerError), msg:
CCompilerError) as msg:
if DEBUG:
raise
else: