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
diff --git a/Lib/smtpd.py b/Lib/smtpd.py
index c656ec7..3b81856 100755
--- a/Lib/smtpd.py
+++ b/Lib/smtpd.py
@@ -357,10 +357,10 @@
refused = s.sendmail(mailfrom, rcpttos, data)
finally:
s.quit()
- except smtplib.SMTPRecipientsRefused, e:
+ except smtplib.SMTPRecipientsRefused as e:
print >> DEBUGSTREAM, 'got SMTPRecipientsRefused'
refused = e.recipients
- except (socket.error, smtplib.SMTPException), e:
+ except (socket.error, smtplib.SMTPException) as e:
print >> DEBUGSTREAM, 'got', e.__class__
# All recipients were refused. If the exception had an associated
# error code, use it. Otherwise,fake it with a non-triggering
@@ -464,7 +464,7 @@
opts, args = getopt.getopt(
sys.argv[1:], 'nVhc:d',
['class=', 'nosetuid', 'version', 'help', 'debug'])
- except getopt.error, e:
+ except getopt.error as e:
usage(1, e)
options = Options()
@@ -528,7 +528,7 @@
nobody = pwd.getpwnam('nobody')[2]
try:
os.setuid(nobody)
- except OSError, e:
+ except OSError as e:
if e.errno != errno.EPERM: raise
print >> sys.stderr, \
'Cannot setuid "nobody"; try running with -n option.'