summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Doc/lib
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-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 'Doc/lib')
-rw-r--r--Doc/lib/email-unpack.py2
-rw-r--r--Doc/lib/libcsv.tex2
-rw-r--r--Doc/lib/libgetopt.tex2
-rw-r--r--Doc/lib/libshutil.tex2
-rw-r--r--Doc/lib/libsocket.tex8
-rw-r--r--Doc/lib/libsubprocess.tex2
-rw-r--r--Doc/lib/libxdrlib.tex2
-rw-r--r--Doc/lib/libxmlrpclib.tex2
-rw-r--r--Doc/lib/sqlite3/complete_statement.py2
9 files changed, 12 insertions, 12 deletions
diff --git a/Doc/lib/email-unpack.py b/Doc/lib/email-unpack.py
index fb03e58..e596b98 100644
--- a/Doc/lib/email-unpack.py
+++ b/Doc/lib/email-unpack.py
@@ -35,7 +35,7 @@ Usage: %prog [options] msgfile
try:
os.mkdir(opts.directory)
- except OSError, e:
+ except OSError as e:
# Ignore directory exists error
if e.errno != errno.EEXIST:
raise
diff --git a/Doc/lib/libcsv.tex b/Doc/lib/libcsv.tex
index e965e31..b87bc9d 100644
--- a/Doc/lib/libcsv.tex
+++ b/Doc/lib/libcsv.tex
@@ -426,7 +426,7 @@ reader = csv.reader(open(filename, "rb"))
try:
for row in reader:
print row
-except csv.Error, e:
+except csv.Error as e:
sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))
\end{verbatim}
diff --git a/Doc/lib/libgetopt.tex b/Doc/lib/libgetopt.tex
index b38fcd8..7930acd 100644
--- a/Doc/lib/libgetopt.tex
+++ b/Doc/lib/libgetopt.tex
@@ -126,7 +126,7 @@ import getopt, sys
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
# print help information and exit:
print str(err) # will print something like "option -a not recognized"
usage()
diff --git a/Doc/lib/libshutil.tex b/Doc/lib/libshutil.tex
index 449d741..3037e0b 100644
--- a/Doc/lib/libshutil.tex
+++ b/Doc/lib/libshutil.tex
@@ -144,6 +144,6 @@ def copytree(src, dst, symlinks=0):
copytree(srcname, dstname, symlinks)
else:
copy2(srcname, dstname)
- except (IOError, os.error), why:
+ except (IOError, os.error) as why:
print "Can't copy %s to %s: %s" % (`srcname`, `dstname`, str(why))
\end{verbatim}
diff --git a/Doc/lib/libsocket.tex b/Doc/lib/libsocket.tex
index f20c56c..69877d3 100644
--- a/Doc/lib/libsocket.tex
+++ b/Doc/lib/libsocket.tex
@@ -813,13 +813,13 @@ for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM,
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
- except socket.error, msg:
+ except socket.error as msg:
s = None
continue
try:
s.bind(sa)
s.listen(1)
- except socket.error, msg:
+ except socket.error as msg:
s.close()
s = None
continue
@@ -848,12 +848,12 @@ for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
- except socket.error, msg:
+ except socket.error as msg:
s = None
continue
try:
s.connect(sa)
- except socket.error, msg:
+ except socket.error as msg:
s.close()
s = None
continue
diff --git a/Doc/lib/libsubprocess.tex b/Doc/lib/libsubprocess.tex
index f639710..cb30974 100644
--- a/Doc/lib/libsubprocess.tex
+++ b/Doc/lib/libsubprocess.tex
@@ -284,7 +284,7 @@ try:
print >>sys.stderr, "Child was terminated by signal", -retcode
else:
print >>sys.stderr, "Child returned", retcode
-except OSError, e:
+except OSError as e:
print >>sys.stderr, "Execution failed:", e
\end{verbatim}
diff --git a/Doc/lib/libxdrlib.tex b/Doc/lib/libxdrlib.tex
index d0863d9..56474b7 100644
--- a/Doc/lib/libxdrlib.tex
+++ b/Doc/lib/libxdrlib.tex
@@ -246,6 +246,6 @@ import xdrlib
p = xdrlib.Packer()
try:
p.pack_double(8.01)
-except xdrlib.ConversionError, instance:
+except xdrlib.ConversionError as instance:
print 'packing the double failed:', instance.msg
\end{verbatim}
diff --git a/Doc/lib/libxmlrpclib.tex b/Doc/lib/libxmlrpclib.tex
index c870d26..7af9e76 100644
--- a/Doc/lib/libxmlrpclib.tex
+++ b/Doc/lib/libxmlrpclib.tex
@@ -358,7 +358,7 @@ print server
try:
print server.examples.getStateName(41)
-except Error, v:
+except Error as v:
print "ERROR", v
\end{verbatim}
diff --git a/Doc/lib/sqlite3/complete_statement.py b/Doc/lib/sqlite3/complete_statement.py
index 22525e3..76ea7f6 100644
--- a/Doc/lib/sqlite3/complete_statement.py
+++ b/Doc/lib/sqlite3/complete_statement.py
@@ -23,7 +23,7 @@ while True:
if buffer.lstrip().upper().startswith("SELECT"):
print cur.fetchall()
- except sqlite3.Error, e:
+ except sqlite3.Error as e:
print "An error occurred:", e.args[0]
buffer = ""