SF patch 1631942 by Collin Winter: · python/cpython@b940e11

GitHub

Original file line numberDiff line numberDiff line change@@ -119,5 +119,5 @@ def store(self):

119119f.write('\n')

120120f.close()

121121return""

122-exceptIOError,err:

122+exceptIOErroraserr:

123123return"IOError: %s"%str(err)

Original file line numberDiff line numberDiff line change@@ -28,7 +28,7 @@ def main():

2828forfileinsys.argv[1:]:

2929try:

3030fp=open(file, 'r')

31-exceptIOError,msg:

31+exceptIOErrorasmsg:

3232print"%s: %s"% (file, msg)

3333continue

3434lineno=0

Original file line numberDiff line numberDiff line change@@ -41,7 +41,7 @@ def main():

4141defreportboguslinks(prefix):

4242try:

4343names=os.listdir('.')

44-exceptos.error,msg:

44+exceptos.errorasmsg:

4545print"%s%s: can't list: %s"% (prefix, '.', msg)

4646return

4747names.sort()

@@ -62,7 +62,7 @@ def reportboguslinks(prefix):

6262elifS_ISDIR(mode):

6363try:

6464os.chdir(name)

65-exceptos.error,msg:

65+exceptos.errorasmsg:

6666print"%s%s: can't chdir: %s"% \

6767 (prefix, name, msg)

6868continue

Original file line numberDiff line numberDiff line change@@ -17,7 +17,7 @@ def testChunk(t, fileName):

1717# against a large source file like Tkinter.py.

1818ast=None

1919new=parser.tuple2ast(tup)

20-exceptparser.ParserError,err:

20+exceptparser.ParserErroraserr:

2121print

2222print'parser module raised exception on input file', fileName+':'

2323traceback.print_exc()

Original file line numberDiff line numberDiff line change@@ -492,7 +492,7 @@ def testdir(a):

492492print'Testing %s'%fullname

493493try:

494494roundtrip(fullname, output)

495-exceptException,e:

495+exceptExceptionase:

496496print' Failed to compile, exception is %s'%repr(e)

497497elifos.path.isdir(fullname):

498498testdir(fullname)

Original file line numberDiff line numberDiff line change@@ -87,7 +87,7 @@ def visible(self, name):

8787fs=macfs.FSSpec(name)

8888c, t=fs.GetCreatorType()

8989ift!='TEXT': return0

90-exceptmacfs.error,msg:

90+exceptmacfs.errorasmsg:

9191print"***", name, msg

9292return0

9393else:

Original file line numberDiff line numberDiff line change@@ -42,7 +42,7 @@ def run(self, args = None):

4242ifargsisNone: args=sys.argv[1:]

4343try:

4444opts, args=getopt.getopt(args, self.GlobalFlags)

45-exceptgetopt.error,msg:

45+exceptgetopt.errorasmsg:

4646returnself.usage(msg)

4747self.options(opts)

4848ifnotargs:

@@ -62,7 +62,7 @@ def run(self, args = None):

6262flags=''

6363try:

6464opts, args=getopt.getopt(args[1:], flags)

65-exceptgetopt.error,msg:

65+exceptgetopt.errorasmsg:

6666returnself.usage(

6767"subcommand %s: "%cmd+str(msg))

6868self.ready()

Original file line numberDiff line numberDiff line change@@ -135,7 +135,7 @@ def compare(local, remote, mode):

135135defsendfile(local, remote, name):

136136try:

137137remote.create(name)

138-except (IOError, os.error),msg:

138+except (IOError, os.error)asmsg:

139139print"cannot create:", msg

140140return

141141@@ -171,7 +171,7 @@ def recvfile(local, remote, name):

171171defrecvfile_real(local, remote, name):

172172try:

173173local.create(name)

174-except (IOError, os.error),msg:

174+except (IOError, os.error)asmsg:

175175print"cannot create:", msg

176176return

177177Original file line numberDiff line numberDiff line change@@ -129,7 +129,7 @@ def setlockdir(self):

129129self.lockdir=self.cvslck

130130os.mkdir(self.cvslck, 0777)

131131return

132-exceptos.error,msg:

132+exceptos.errorasmsg:

133133self.lockdir=None

134134ifmsg[0] ==EEXIST:

135135try:

@@ -234,7 +234,7 @@ def MultipleWriteLock(repositories, delay = DELAY):

234234forrinrepositories:

235235try:

236236locks.append(WriteLock(r, 0))

237-exceptLocked,instance:

237+exceptLockedasinstance:

238238dellocks

239239break

240240else:

Original file line numberDiff line numberDiff line change@@ -22,7 +22,7 @@ def main():

2222raisegetopt.error, "unknown command"

2323coptset, func=commands[cmd]

2424copts, files=getopt.getopt(rest, coptset)

25-exceptgetopt.error,msg:

25+exceptgetopt.errorasmsg:

2626printmsg

2727print"usage: rrcs [options] command [options] [file] ..."

2828print"where command can be:"

@@ -41,7 +41,7 @@ def main():

4141forfninfiles:

4242try:

4343func(x, copts, fn)

44-except (IOError, os.error),msg:

44+except (IOError, os.error)asmsg:

4545print"%s: %s"% (fn, msg)

46464747defcheckin(x, copts, fn):