[Python-3000-checkins] r53342 - in python/branches/p3yk: Demo/cgi/wiki.py Demo/comparisons/regextest.py Demo/comparisons/systemtest.py Demo/parser/test_parser.py Demo/parser/unparse.py Demo/pdist/FSProxy.py Demo/pdist/cmdfw.py Demo/pdist/cmptree.py Demo/pdist/cvslock.py Demo/pdist/rrcs.py Demo/pysvr/pysvr.py Demo/rpc/nfsclient.py Demo/rpc/rpc.py Demo/scripts/eqfix.py Demo/scripts/ftpstats.py Demo/scripts/mboxconvert.py Demo/scripts/newslist.py Demo/scripts/pp.py Demo/scripts/update.py Demo/sockets/gopher.py Demo/sockets/telnet.py Demo/threads/find.py Demo/threads/telnet.py Demo/tkinter/guido/AttrDialog.py Demo/tkinter/guido/ManPage.py Demo/tkinter/guido/mbox.py Demo/tkinter/guido/tkman.py Demo/tkinter/guido/wish.py Doc/howto/urllib2.rst Doc/lib/email-unpack.py Doc/lib/libcsv.tex Doc/lib/libgetopt.tex Doc/lib/libshutil.tex Doc/lib/libsocket.tex Doc/lib/libsubprocess.tex Doc/lib/libxdrlib.tex Doc/lib/libxmlrpclib.tex Doc/lib/sqlite3/complete_statement.py Doc/tools/findcsyms Doc/tools/listmodules Doc/tools/mkhowto Doc/tools/mksourcepkg Doc/tools/prechm.py Doc/tools/sgmlconv/docfixer.py Doc/tools/sgmlconv/esis2sgml.py Doc/tools/sgmlconv/esistools.py Doc/tools/sgmlconv/latex2esis.py Doc/tut/tut.tex Grammar/Grammar Lib/CGIHTTPServer.py Lib/ConfigParser.py Lib/SimpleXMLRPCServer.py Lib/_strptime.py Lib/asynchat.py Lib/asyncore.py Lib/base64.py Lib/bsddb/dbtables.py Lib/bsddb/test/test_basics.py Lib/bsddb/test/test_compare.py Lib/bsddb/test/test_pickle.py Lib/bsddb/test/test_recno.py Lib/bsddb/test/test_thread.py Lib/cgi.py Lib/codecs.py Lib/codeop.py Lib/compileall.py Lib/compiler/pycodegen.py Lib/contextlib.py Lib/csv.py Lib/ctypes/macholib/dyld.py Lib/ctypes/test/__init__.py Lib/ctypes/test/test_bitfields.py Lib/ctypes/test/test_structures.py Lib/ctypes/util.py Lib/dis.py Lib/distutils/bcppcompiler.py Lib/distutils/command/register.py Lib/distutils/command/sdist.py Lib/distutils/command/upload.py Lib/distutils/core.py Lib/distutils/cygwinccompiler.py Lib/distutils/dir_util.py Lib/distutils/dist.py Lib/distutils/emxccompiler.py Lib/distutils/fancy_getopt.py Lib/distutils/file_util.py Lib/distutils/msvccompiler.py Lib/distutils/spawn.py Lib/distutils/sysconfig.py Lib/distutils/unixccompiler.py Lib/distutils/util.py Lib/doctest.py Lib/encodings/uu_codec.py Lib/filecmp.py Lib/ftplib.py Lib/hotshot/stones.py Lib/htmllib.py Lib/httplib.py Lib/idlelib/ClassBrowser.py Lib/idlelib/EditorWindow.py Lib/idlelib/GrepDialog.py Lib/idlelib/IOBinding.py Lib/idlelib/PyShell.py Lib/idlelib/ScriptBinding.py Lib/idlelib/SearchEngine.py Lib/idlelib/run.py Lib/imaplib.py Lib/lib-tk/Tkinter.py Lib/linecache.py Lib/logging/config.py Lib/mailbox.py Lib/mhlib.py Lib/mimetypes.py Lib/modulefinder.py Lib/msilib/__init__.py Lib/nntplib.py Lib/optparse.py Lib/os.py Lib/pdb.py Lib/pickle.py Lib/pkgutil.py Lib/plat-irix5/torgb.py Lib/plat-irix6/torgb.py Lib/plat-mac/EasyDialogs.py Lib/plat-mac/MiniAEFrame.py Lib/plat-mac/aetools.py Lib/plat-mac/applesingle.py Lib/plat-mac/argvemulator.py Lib/plat-mac/buildtools.py Lib/plat-mac/bundlebuilder.py Lib/plat-mac/gensuitemodule.py Lib/plat-mac/macresource.py Lib/plat-mac/pimp.py Lib/plat-mac/terminalcommand.py Lib/platform.py Lib/poplib.py Lib/pstats.py Lib/pty.py Lib/py_compile.py Lib/pydoc.py Lib/quopri.py Lib/re.py Lib/rexec.py Lib/sgmllib.py Lib/shutil.py Lib/site.py Lib/smtpd.py Lib/smtplib.py Lib/sqlite3/test/dbapi.py Lib/sqlite3/test/hooks.py Lib/sqlite3/test/userfunctions.py Lib/subprocess.py Lib/tabnanny.py Lib/tarfile.py Lib/telnetlib.py Lib/tempfile.py Lib/test/pickletester.py Lib/test/regrtest.py Lib/test/sortperf.py Lib/test/string_tests.py Lib/test/test_bool.py Lib/test/test_cfgparser.py Lib/test/test_cgi.py Lib/test/test_class.py Lib/test/test_codecs.py Lib/test/test_compiler.py Lib/test/test_contextlib.py Lib/test/test_cookielib.py Lib/test/test_dbm.py Lib/test/test_decimal.py Lib/test/test_defaultdict.py Lib/test/test_descr.py Lib/test/test_dict.py Lib/test/test_dl.py Lib/test/test_eof.py Lib/test/test_exceptions.py Lib/test/test_extcall.py Lib/test/test_file.py Lib/test/test_format.py Lib/test/test_frozen.py Lib/test/test_future.py Lib/test/test_generators.py Lib/test/test_grammar.py Lib/test/test_import.py Lib/test/test_linuxaudiodev.py Lib/test/test_nis.py Lib/test/test_opcodes.py Lib/test/test_optparse.py Lib/test/test_os.py Lib/test/test_ossaudiodev.py Lib/test/test_parser.py Lib/test/test_pep277.py Lib/test/test_pyexpat.py Lib/test/test_re.py Lib/test/test_runpy.py Lib/test/test_sax.py Lib/test/test_set.py Lib/test/test_socket.py Lib/test/test_socket_ssl.py Lib/test/test_socketserver.py Lib/test/test_strftime.py Lib/test/test_string.py Lib/test/test_strptime.py Lib/test/test_subprocess.py Lib/test/test_sunaudiodev.py Lib/test/test_support.py Lib/test/test_syntax.py Lib/test/test_sys.py Lib/test/test_tarfile.py Lib/test/test_tcl.py Lib/test/test_trace.py Lib/test/test_traceback.py Lib/test/test_urllib2net.py Lib/test/test_userdict.py Lib/test/test_uu.py Lib/test/test_winreg.py Lib/timeit.py Lib/toaiff.py Lib/token.py Lib/trace.py Lib/unittest.py Lib/urllib.py Lib/urllib2.py Lib/uu.py Lib/warnings.py Lib/webbrowser.py Lib/xdrlib.py Lib/xml/sax/__init__.py Lib/xml/sax/expatreader.py Lib/xmllib.py Lib/xmlrpclib.py Lib/zipfile.py Mac/BuildScript/build-installer.py Mac/Demo/applescript/makedisk.py Mac/Demo/imgbrowse/imgbrowse.py Mac/Demo/mlte/mlted.py Mac/Demo/resources/copyres.py Mac/Demo/textedit/ped.py Mac/scripts/BuildApplet.py Mac/scripts/buildpkg.py Misc/BeOS-setup.py Modules/parsermodule.c Python/compile.c Python/graminit.c Tools/audiopy/audiopy Tools/bgen/bgen/scantools.py Tools/compiler/compile.py Tools/compiler/regrtest.py Tools/faqwiz/faqw.py Tools/faqwiz/faqwiz.py Tools/freeze/checkextensions_win32.py Tools/freeze/freeze.py Tools/i18n/msgfmt.py Tools/i18n/pygettext.py Tools/pybench/CommandLine.py Tools/pybench/pybench.py Tools/pynche/Main.py Tools/scripts/byext.py Tools/scripts/byteyears.py Tools/scripts/checkappend.py Tools/scripts/classfix.py Tools/scripts/cleanfuture.py Tools/scripts/cvsfiles.py Tools/scripts/dutree.py Tools/scripts/finddiv.py Tools/scripts/findlinksto.py Tools/scripts/findnocoding.py Tools/scripts/fixcid.py Tools/scripts/fixdiv.py Tools/scripts/fixheader.py Tools/scripts/fixnotice.py Tools/scripts/fixps.py Tools/scripts/ftpmirror.py Tools/scripts/linktree.py Tools/scripts/logmerge.py Tools/scripts/md5sum.py Tools/scripts/methfix.py Tools/scripts/ndiff.py Tools/scripts/pathfix.py Tools/scripts/pindent.py Tools/scripts/pysource.py Tools/scripts/redemo.py Tools/scripts/reindent.py Tools/scripts/rgrep.py Tools/scripts/texi2html.py Tools/scripts/treesync.py Tools/scripts/untabify.py Tools/unicode/comparecodecs.py Tools/unicode/gencodec.py Tools/unicode/listcodecs.py Tools/versioncheck/pyversioncheck.py Tools/webchecker/wcgui.py Tools/webchecker/webchecker.py Tools/webchecker/websucker.py setup.py

guido.van.rossum python-3000-checkins at python.org
Wed Jan 10 17:20:35 CET 2007


Author: guido.van.rossum
Date: Wed Jan 10 17:19:56 2007
New Revision: 53342

Modified:
   python/branches/p3yk/Demo/cgi/wiki.py
   python/branches/p3yk/Demo/comparisons/regextest.py
   python/branches/p3yk/Demo/comparisons/systemtest.py
   python/branches/p3yk/Demo/parser/test_parser.py
   python/branches/p3yk/Demo/parser/unparse.py
   python/branches/p3yk/Demo/pdist/FSProxy.py
   python/branches/p3yk/Demo/pdist/cmdfw.py
   python/branches/p3yk/Demo/pdist/cmptree.py
   python/branches/p3yk/Demo/pdist/cvslock.py
   python/branches/p3yk/Demo/pdist/rrcs.py
   python/branches/p3yk/Demo/pysvr/pysvr.py
   python/branches/p3yk/Demo/rpc/nfsclient.py
   python/branches/p3yk/Demo/rpc/rpc.py
   python/branches/p3yk/Demo/scripts/eqfix.py
   python/branches/p3yk/Demo/scripts/ftpstats.py
   python/branches/p3yk/Demo/scripts/mboxconvert.py
   python/branches/p3yk/Demo/scripts/newslist.py
   python/branches/p3yk/Demo/scripts/pp.py
   python/branches/p3yk/Demo/scripts/update.py
   python/branches/p3yk/Demo/sockets/gopher.py
   python/branches/p3yk/Demo/sockets/telnet.py
   python/branches/p3yk/Demo/threads/find.py
   python/branches/p3yk/Demo/threads/telnet.py
   python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py
   python/branches/p3yk/Demo/tkinter/guido/ManPage.py
   python/branches/p3yk/Demo/tkinter/guido/mbox.py
   python/branches/p3yk/Demo/tkinter/guido/tkman.py
   python/branches/p3yk/Demo/tkinter/guido/wish.py
   python/branches/p3yk/Doc/howto/urllib2.rst
   python/branches/p3yk/Doc/lib/email-unpack.py
   python/branches/p3yk/Doc/lib/libcsv.tex
   python/branches/p3yk/Doc/lib/libgetopt.tex
   python/branches/p3yk/Doc/lib/libshutil.tex
   python/branches/p3yk/Doc/lib/libsocket.tex
   python/branches/p3yk/Doc/lib/libsubprocess.tex
   python/branches/p3yk/Doc/lib/libxdrlib.tex
   python/branches/p3yk/Doc/lib/libxmlrpclib.tex
   python/branches/p3yk/Doc/lib/sqlite3/complete_statement.py
   python/branches/p3yk/Doc/tools/findcsyms
   python/branches/p3yk/Doc/tools/listmodules
   python/branches/p3yk/Doc/tools/mkhowto
   python/branches/p3yk/Doc/tools/mksourcepkg
   python/branches/p3yk/Doc/tools/prechm.py
   python/branches/p3yk/Doc/tools/sgmlconv/docfixer.py
   python/branches/p3yk/Doc/tools/sgmlconv/esis2sgml.py
   python/branches/p3yk/Doc/tools/sgmlconv/esistools.py
   python/branches/p3yk/Doc/tools/sgmlconv/latex2esis.py
   python/branches/p3yk/Doc/tut/tut.tex
   python/branches/p3yk/Grammar/Grammar
   python/branches/p3yk/Lib/CGIHTTPServer.py
   python/branches/p3yk/Lib/ConfigParser.py
   python/branches/p3yk/Lib/SimpleXMLRPCServer.py
   python/branches/p3yk/Lib/_strptime.py
   python/branches/p3yk/Lib/asynchat.py
   python/branches/p3yk/Lib/asyncore.py
   python/branches/p3yk/Lib/base64.py
   python/branches/p3yk/Lib/bsddb/dbtables.py
   python/branches/p3yk/Lib/bsddb/test/test_basics.py
   python/branches/p3yk/Lib/bsddb/test/test_compare.py
   python/branches/p3yk/Lib/bsddb/test/test_pickle.py
   python/branches/p3yk/Lib/bsddb/test/test_recno.py
   python/branches/p3yk/Lib/bsddb/test/test_thread.py
   python/branches/p3yk/Lib/cgi.py
   python/branches/p3yk/Lib/codecs.py
   python/branches/p3yk/Lib/codeop.py
   python/branches/p3yk/Lib/compileall.py
   python/branches/p3yk/Lib/compiler/pycodegen.py
   python/branches/p3yk/Lib/contextlib.py
   python/branches/p3yk/Lib/csv.py
   python/branches/p3yk/Lib/ctypes/macholib/dyld.py
   python/branches/p3yk/Lib/ctypes/test/__init__.py
   python/branches/p3yk/Lib/ctypes/test/test_bitfields.py
   python/branches/p3yk/Lib/ctypes/test/test_structures.py
   python/branches/p3yk/Lib/ctypes/util.py
   python/branches/p3yk/Lib/dis.py
   python/branches/p3yk/Lib/distutils/bcppcompiler.py
   python/branches/p3yk/Lib/distutils/command/register.py
   python/branches/p3yk/Lib/distutils/command/sdist.py
   python/branches/p3yk/Lib/distutils/command/upload.py
   python/branches/p3yk/Lib/distutils/core.py
   python/branches/p3yk/Lib/distutils/cygwinccompiler.py
   python/branches/p3yk/Lib/distutils/dir_util.py
   python/branches/p3yk/Lib/distutils/dist.py
   python/branches/p3yk/Lib/distutils/emxccompiler.py
   python/branches/p3yk/Lib/distutils/fancy_getopt.py
   python/branches/p3yk/Lib/distutils/file_util.py
   python/branches/p3yk/Lib/distutils/msvccompiler.py
   python/branches/p3yk/Lib/distutils/spawn.py
   python/branches/p3yk/Lib/distutils/sysconfig.py
   python/branches/p3yk/Lib/distutils/unixccompiler.py
   python/branches/p3yk/Lib/distutils/util.py
   python/branches/p3yk/Lib/doctest.py
   python/branches/p3yk/Lib/encodings/uu_codec.py
   python/branches/p3yk/Lib/filecmp.py
   python/branches/p3yk/Lib/ftplib.py
   python/branches/p3yk/Lib/hotshot/stones.py
   python/branches/p3yk/Lib/htmllib.py
   python/branches/p3yk/Lib/httplib.py
   python/branches/p3yk/Lib/idlelib/ClassBrowser.py
   python/branches/p3yk/Lib/idlelib/EditorWindow.py
   python/branches/p3yk/Lib/idlelib/GrepDialog.py
   python/branches/p3yk/Lib/idlelib/IOBinding.py
   python/branches/p3yk/Lib/idlelib/PyShell.py
   python/branches/p3yk/Lib/idlelib/ScriptBinding.py
   python/branches/p3yk/Lib/idlelib/SearchEngine.py
   python/branches/p3yk/Lib/idlelib/run.py
   python/branches/p3yk/Lib/imaplib.py
   python/branches/p3yk/Lib/lib-tk/Tkinter.py
   python/branches/p3yk/Lib/linecache.py
   python/branches/p3yk/Lib/logging/config.py
   python/branches/p3yk/Lib/mailbox.py
   python/branches/p3yk/Lib/mhlib.py
   python/branches/p3yk/Lib/mimetypes.py
   python/branches/p3yk/Lib/modulefinder.py
   python/branches/p3yk/Lib/msilib/__init__.py
   python/branches/p3yk/Lib/nntplib.py
   python/branches/p3yk/Lib/optparse.py
   python/branches/p3yk/Lib/os.py
   python/branches/p3yk/Lib/pdb.py
   python/branches/p3yk/Lib/pickle.py
   python/branches/p3yk/Lib/pkgutil.py
   python/branches/p3yk/Lib/plat-irix5/torgb.py
   python/branches/p3yk/Lib/plat-irix6/torgb.py
   python/branches/p3yk/Lib/plat-mac/EasyDialogs.py
   python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py
   python/branches/p3yk/Lib/plat-mac/aetools.py
   python/branches/p3yk/Lib/plat-mac/applesingle.py
   python/branches/p3yk/Lib/plat-mac/argvemulator.py
   python/branches/p3yk/Lib/plat-mac/buildtools.py
   python/branches/p3yk/Lib/plat-mac/bundlebuilder.py
   python/branches/p3yk/Lib/plat-mac/gensuitemodule.py
   python/branches/p3yk/Lib/plat-mac/macresource.py
   python/branches/p3yk/Lib/plat-mac/pimp.py
   python/branches/p3yk/Lib/plat-mac/terminalcommand.py
   python/branches/p3yk/Lib/platform.py
   python/branches/p3yk/Lib/poplib.py
   python/branches/p3yk/Lib/pstats.py
   python/branches/p3yk/Lib/pty.py
   python/branches/p3yk/Lib/py_compile.py
   python/branches/p3yk/Lib/pydoc.py
   python/branches/p3yk/Lib/quopri.py
   python/branches/p3yk/Lib/re.py
   python/branches/p3yk/Lib/rexec.py
   python/branches/p3yk/Lib/sgmllib.py
   python/branches/p3yk/Lib/shutil.py
   python/branches/p3yk/Lib/site.py
   python/branches/p3yk/Lib/smtpd.py
   python/branches/p3yk/Lib/smtplib.py
   python/branches/p3yk/Lib/sqlite3/test/dbapi.py
   python/branches/p3yk/Lib/sqlite3/test/hooks.py
   python/branches/p3yk/Lib/sqlite3/test/userfunctions.py
   python/branches/p3yk/Lib/subprocess.py
   python/branches/p3yk/Lib/tabnanny.py
   python/branches/p3yk/Lib/tarfile.py
   python/branches/p3yk/Lib/telnetlib.py
   python/branches/p3yk/Lib/tempfile.py
   python/branches/p3yk/Lib/test/pickletester.py
   python/branches/p3yk/Lib/test/regrtest.py
   python/branches/p3yk/Lib/test/sortperf.py
   python/branches/p3yk/Lib/test/string_tests.py
   python/branches/p3yk/Lib/test/test_bool.py
   python/branches/p3yk/Lib/test/test_cfgparser.py
   python/branches/p3yk/Lib/test/test_cgi.py
   python/branches/p3yk/Lib/test/test_class.py
   python/branches/p3yk/Lib/test/test_codecs.py
   python/branches/p3yk/Lib/test/test_compiler.py
   python/branches/p3yk/Lib/test/test_contextlib.py
   python/branches/p3yk/Lib/test/test_cookielib.py
   python/branches/p3yk/Lib/test/test_dbm.py
   python/branches/p3yk/Lib/test/test_decimal.py
   python/branches/p3yk/Lib/test/test_defaultdict.py
   python/branches/p3yk/Lib/test/test_descr.py
   python/branches/p3yk/Lib/test/test_dict.py
   python/branches/p3yk/Lib/test/test_dl.py
   python/branches/p3yk/Lib/test/test_eof.py
   python/branches/p3yk/Lib/test/test_exceptions.py
   python/branches/p3yk/Lib/test/test_extcall.py
   python/branches/p3yk/Lib/test/test_file.py
   python/branches/p3yk/Lib/test/test_format.py
   python/branches/p3yk/Lib/test/test_frozen.py
   python/branches/p3yk/Lib/test/test_future.py
   python/branches/p3yk/Lib/test/test_generators.py
   python/branches/p3yk/Lib/test/test_grammar.py
   python/branches/p3yk/Lib/test/test_import.py
   python/branches/p3yk/Lib/test/test_linuxaudiodev.py
   python/branches/p3yk/Lib/test/test_nis.py
   python/branches/p3yk/Lib/test/test_opcodes.py
   python/branches/p3yk/Lib/test/test_optparse.py
   python/branches/p3yk/Lib/test/test_os.py
   python/branches/p3yk/Lib/test/test_ossaudiodev.py
   python/branches/p3yk/Lib/test/test_parser.py
   python/branches/p3yk/Lib/test/test_pep277.py
   python/branches/p3yk/Lib/test/test_pyexpat.py
   python/branches/p3yk/Lib/test/test_re.py
   python/branches/p3yk/Lib/test/test_runpy.py
   python/branches/p3yk/Lib/test/test_sax.py
   python/branches/p3yk/Lib/test/test_set.py
   python/branches/p3yk/Lib/test/test_socket.py
   python/branches/p3yk/Lib/test/test_socket_ssl.py
   python/branches/p3yk/Lib/test/test_socketserver.py
   python/branches/p3yk/Lib/test/test_strftime.py
   python/branches/p3yk/Lib/test/test_string.py
   python/branches/p3yk/Lib/test/test_strptime.py
   python/branches/p3yk/Lib/test/test_subprocess.py
   python/branches/p3yk/Lib/test/test_sunaudiodev.py
   python/branches/p3yk/Lib/test/test_support.py
   python/branches/p3yk/Lib/test/test_syntax.py
   python/branches/p3yk/Lib/test/test_sys.py
   python/branches/p3yk/Lib/test/test_tarfile.py
   python/branches/p3yk/Lib/test/test_tcl.py
   python/branches/p3yk/Lib/test/test_trace.py
   python/branches/p3yk/Lib/test/test_traceback.py
   python/branches/p3yk/Lib/test/test_urllib2net.py
   python/branches/p3yk/Lib/test/test_userdict.py
   python/branches/p3yk/Lib/test/test_uu.py
   python/branches/p3yk/Lib/test/test_winreg.py
   python/branches/p3yk/Lib/timeit.py
   python/branches/p3yk/Lib/toaiff.py
   python/branches/p3yk/Lib/token.py
   python/branches/p3yk/Lib/trace.py
   python/branches/p3yk/Lib/unittest.py
   python/branches/p3yk/Lib/urllib.py
   python/branches/p3yk/Lib/urllib2.py
   python/branches/p3yk/Lib/uu.py
   python/branches/p3yk/Lib/warnings.py
   python/branches/p3yk/Lib/webbrowser.py
   python/branches/p3yk/Lib/xdrlib.py
   python/branches/p3yk/Lib/xml/sax/__init__.py
   python/branches/p3yk/Lib/xml/sax/expatreader.py
   python/branches/p3yk/Lib/xmllib.py
   python/branches/p3yk/Lib/xmlrpclib.py
   python/branches/p3yk/Lib/zipfile.py
   python/branches/p3yk/Mac/BuildScript/build-installer.py
   python/branches/p3yk/Mac/Demo/applescript/makedisk.py
   python/branches/p3yk/Mac/Demo/imgbrowse/imgbrowse.py
   python/branches/p3yk/Mac/Demo/mlte/mlted.py
   python/branches/p3yk/Mac/Demo/resources/copyres.py
   python/branches/p3yk/Mac/Demo/textedit/ped.py
   python/branches/p3yk/Mac/scripts/BuildApplet.py
   python/branches/p3yk/Mac/scripts/buildpkg.py
   python/branches/p3yk/Misc/BeOS-setup.py
   python/branches/p3yk/Modules/parsermodule.c
   python/branches/p3yk/Python/compile.c
   python/branches/p3yk/Python/graminit.c
   python/branches/p3yk/Tools/audiopy/audiopy
   python/branches/p3yk/Tools/bgen/bgen/scantools.py
   python/branches/p3yk/Tools/compiler/compile.py
   python/branches/p3yk/Tools/compiler/regrtest.py
   python/branches/p3yk/Tools/faqwiz/faqw.py
   python/branches/p3yk/Tools/faqwiz/faqwiz.py
   python/branches/p3yk/Tools/freeze/checkextensions_win32.py
   python/branches/p3yk/Tools/freeze/freeze.py
   python/branches/p3yk/Tools/i18n/msgfmt.py
   python/branches/p3yk/Tools/i18n/pygettext.py
   python/branches/p3yk/Tools/pybench/CommandLine.py
   python/branches/p3yk/Tools/pybench/pybench.py
   python/branches/p3yk/Tools/pynche/Main.py
   python/branches/p3yk/Tools/scripts/byext.py
   python/branches/p3yk/Tools/scripts/byteyears.py
   python/branches/p3yk/Tools/scripts/checkappend.py
   python/branches/p3yk/Tools/scripts/classfix.py
   python/branches/p3yk/Tools/scripts/cleanfuture.py
   python/branches/p3yk/Tools/scripts/cvsfiles.py
   python/branches/p3yk/Tools/scripts/dutree.py
   python/branches/p3yk/Tools/scripts/finddiv.py
   python/branches/p3yk/Tools/scripts/findlinksto.py
   python/branches/p3yk/Tools/scripts/findnocoding.py
   python/branches/p3yk/Tools/scripts/fixcid.py
   python/branches/p3yk/Tools/scripts/fixdiv.py
   python/branches/p3yk/Tools/scripts/fixheader.py
   python/branches/p3yk/Tools/scripts/fixnotice.py
   python/branches/p3yk/Tools/scripts/fixps.py
   python/branches/p3yk/Tools/scripts/ftpmirror.py
   python/branches/p3yk/Tools/scripts/linktree.py
   python/branches/p3yk/Tools/scripts/logmerge.py
   python/branches/p3yk/Tools/scripts/md5sum.py
   python/branches/p3yk/Tools/scripts/methfix.py
   python/branches/p3yk/Tools/scripts/ndiff.py
   python/branches/p3yk/Tools/scripts/pathfix.py
   python/branches/p3yk/Tools/scripts/pindent.py
   python/branches/p3yk/Tools/scripts/pysource.py
   python/branches/p3yk/Tools/scripts/redemo.py
   python/branches/p3yk/Tools/scripts/reindent.py
   python/branches/p3yk/Tools/scripts/rgrep.py
   python/branches/p3yk/Tools/scripts/texi2html.py
   python/branches/p3yk/Tools/scripts/treesync.py
   python/branches/p3yk/Tools/scripts/untabify.py
   python/branches/p3yk/Tools/unicode/comparecodecs.py
   python/branches/p3yk/Tools/unicode/gencodec.py
   python/branches/p3yk/Tools/unicode/listcodecs.py
   python/branches/p3yk/Tools/versioncheck/pyversioncheck.py
   python/branches/p3yk/Tools/webchecker/wcgui.py
   python/branches/p3yk/Tools/webchecker/webchecker.py
   python/branches/p3yk/Tools/webchecker/websucker.py
   python/branches/p3yk/setup.py
Log:
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


Modified: python/branches/p3yk/Demo/cgi/wiki.py
==============================================================================
--- python/branches/p3yk/Demo/cgi/wiki.py	(original)
+++ python/branches/p3yk/Demo/cgi/wiki.py	Wed Jan 10 17:19:56 2007
@@ -119,5 +119,5 @@
                 f.write('\n')
             f.close()
             return ""
-        except IOError, err:
+        except IOError as err:
             return "IOError: %s" % str(err)

Modified: python/branches/p3yk/Demo/comparisons/regextest.py
==============================================================================
--- python/branches/p3yk/Demo/comparisons/regextest.py	(original)
+++ python/branches/p3yk/Demo/comparisons/regextest.py	Wed Jan 10 17:19:56 2007
@@ -28,7 +28,7 @@
     for file in sys.argv[1:]:
         try:
             fp = open(file, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print "%s: %s" % (file, msg)
             continue
         lineno = 0

Modified: python/branches/p3yk/Demo/comparisons/systemtest.py
==============================================================================
--- python/branches/p3yk/Demo/comparisons/systemtest.py	(original)
+++ python/branches/p3yk/Demo/comparisons/systemtest.py	Wed Jan 10 17:19:56 2007
@@ -41,7 +41,7 @@
 def reportboguslinks(prefix):
     try:
         names = os.listdir('.')
-    except os.error, msg:
+    except os.error as msg:
         print "%s%s: can't list: %s" % (prefix, '.', msg)
         return
     names.sort()
@@ -62,7 +62,7 @@
         elif S_ISDIR(mode):
             try:
                 os.chdir(name)
-            except os.error, msg:
+            except os.error as msg:
                 print "%s%s: can't chdir: %s" % \
                       (prefix, name, msg)
                 continue

Modified: python/branches/p3yk/Demo/parser/test_parser.py
==============================================================================
--- python/branches/p3yk/Demo/parser/test_parser.py	(original)
+++ python/branches/p3yk/Demo/parser/test_parser.py	Wed Jan 10 17:19:56 2007
@@ -17,7 +17,7 @@
         # against a large source file like Tkinter.py.
         ast = None
         new = parser.tuple2ast(tup)
-    except parser.ParserError, err:
+    except parser.ParserError as err:
         print
         print 'parser module raised exception on input file', fileName + ':'
         traceback.print_exc()

Modified: python/branches/p3yk/Demo/parser/unparse.py
==============================================================================
--- python/branches/p3yk/Demo/parser/unparse.py	(original)
+++ python/branches/p3yk/Demo/parser/unparse.py	Wed Jan 10 17:19:56 2007
@@ -492,7 +492,7 @@
                 print 'Testing %s' % fullname
                 try:
                     roundtrip(fullname, output)
-                except Exception, e:
+                except Exception as e:
                     print '  Failed to compile, exception is %s' % repr(e)
             elif os.path.isdir(fullname):
                 testdir(fullname)

Modified: python/branches/p3yk/Demo/pdist/FSProxy.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/FSProxy.py	(original)
+++ python/branches/p3yk/Demo/pdist/FSProxy.py	Wed Jan 10 17:19:56 2007
@@ -87,7 +87,7 @@
                     fs = macfs.FSSpec(name)
                     c, t = fs.GetCreatorType()
                     if t != 'TEXT': return 0
-                except macfs.error, msg:
+                except macfs.error as msg:
                     print "***", name, msg
                     return 0
         else:

Modified: python/branches/p3yk/Demo/pdist/cmdfw.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/cmdfw.py	(original)
+++ python/branches/p3yk/Demo/pdist/cmdfw.py	Wed Jan 10 17:19:56 2007
@@ -42,7 +42,7 @@
         if args is None: args = sys.argv[1:]
         try:
             opts, args = getopt.getopt(args, self.GlobalFlags)
-        except getopt.error, msg:
+        except getopt.error as msg:
             return self.usage(msg)
         self.options(opts)
         if not args:
@@ -62,7 +62,7 @@
                 flags = ''
             try:
                 opts, args = getopt.getopt(args[1:], flags)
-            except getopt.error, msg:
+            except getopt.error as msg:
                 return self.usage(
                         "subcommand %s: " % cmd + str(msg))
             self.ready()

Modified: python/branches/p3yk/Demo/pdist/cmptree.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/cmptree.py	(original)
+++ python/branches/p3yk/Demo/pdist/cmptree.py	Wed Jan 10 17:19:56 2007
@@ -135,7 +135,7 @@
 def sendfile(local, remote, name):
     try:
         remote.create(name)
-    except (IOError, os.error), msg:
+    except (IOError, os.error) as msg:
         print "cannot create:", msg
         return
 
@@ -171,7 +171,7 @@
 def recvfile_real(local, remote, name):
     try:
         local.create(name)
-    except (IOError, os.error), msg:
+    except (IOError, os.error) as msg:
         print "cannot create:", msg
         return
 

Modified: python/branches/p3yk/Demo/pdist/cvslock.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/cvslock.py	(original)
+++ python/branches/p3yk/Demo/pdist/cvslock.py	Wed Jan 10 17:19:56 2007
@@ -129,7 +129,7 @@
                 self.lockdir = self.cvslck
                 os.mkdir(self.cvslck, 0777)
                 return
-            except os.error, msg:
+            except os.error as msg:
                 self.lockdir = None
                 if msg[0] == EEXIST:
                     try:
@@ -234,7 +234,7 @@
         for r in repositories:
             try:
                 locks.append(WriteLock(r, 0))
-            except Locked, instance:
+            except Locked as instance:
                 del locks
                 break
         else:

Modified: python/branches/p3yk/Demo/pdist/rrcs.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/rrcs.py	(original)
+++ python/branches/p3yk/Demo/pdist/rrcs.py	Wed Jan 10 17:19:56 2007
@@ -22,7 +22,7 @@
             raise getopt.error, "unknown command"
         coptset, func = commands[cmd]
         copts, files = getopt.getopt(rest, coptset)
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print "usage: rrcs [options] command [options] [file] ..."
         print "where command can be:"
@@ -41,7 +41,7 @@
     for fn in files:
         try:
             func(x, copts, fn)
-        except (IOError, os.error), msg:
+        except (IOError, os.error) as msg:
             print "%s: %s" % (fn, msg)
 
 def checkin(x, copts, fn):

Modified: python/branches/p3yk/Demo/pysvr/pysvr.py
==============================================================================
--- python/branches/p3yk/Demo/pysvr/pysvr.py	(original)
+++ python/branches/p3yk/Demo/pysvr/pysvr.py	Wed Jan 10 17:19:56 2007
@@ -21,14 +21,14 @@
         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 @@
         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 @@
         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 @@
         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()

Modified: python/branches/p3yk/Demo/rpc/nfsclient.py
==============================================================================
--- python/branches/p3yk/Demo/rpc/nfsclient.py	(original)
+++ python/branches/p3yk/Demo/rpc/nfsclient.py	Wed Jan 10 17:19:56 2007
@@ -194,8 +194,7 @@
     fh = sf[1]
     if fh:
         ncl = NFSClient(host)
-        as = ncl.Getattr(fh)
-        print as
+        print ncl.Getattr(fh)
         list = ncl.Listdir(fh)
         for item in list: print item
         mcl.Umnt(filesys)

Modified: python/branches/p3yk/Demo/rpc/rpc.py
==============================================================================
--- python/branches/p3yk/Demo/rpc/rpc.py	(original)
+++ python/branches/p3yk/Demo/rpc/rpc.py	Wed Jan 10 17:19:56 2007
@@ -330,7 +330,8 @@
         try:
             sock.bind((host, i))
             return last_resv_port_tried
-        except socket.error, (errno, msg):
+        except socket.error as e:
+            (errno, msg) = e
             if errno != 114:
                 raise socket.error, (errno, msg)
     raise RuntimeError, 'can\'t assign reserved port'
@@ -765,7 +766,7 @@
                 call = recvrecord(sock)
             except EOFError:
                 break
-            except socket.error, msg:
+            except socket.error as msg:
                 print 'socket error:', msg
                 break
             reply = self.handle(call)
@@ -866,7 +867,7 @@
     s = S('', 0x20000000, 1, 0)
     try:
         s.unregister()
-    except RuntimeError, msg:
+    except RuntimeError as msg:
         print 'RuntimeError:', msg, '(ignored)'
     s.register()
     print 'Service started...'

Modified: python/branches/p3yk/Demo/scripts/eqfix.py
==============================================================================
--- python/branches/p3yk/Demo/scripts/eqfix.py	(original)
+++ python/branches/p3yk/Demo/scripts/eqfix.py	Wed Jan 10 17:19:56 2007
@@ -62,7 +62,7 @@
     bad = 0
     try:
         names = os.listdir(dirname)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: cannot list directory: %r\n' % (dirname, msg))
         return 1
     names.sort()
@@ -83,7 +83,7 @@
 ##      dbg('fix(%r)\n' % (dirname,))
     try:
         f = open(filename, 'r')
-    except IOError, msg:
+    except IOError as msg:
         err('%s: cannot open: %r\n' % (filename, msg))
         return 1
     head, tail = os.path.split(filename)
@@ -120,7 +120,7 @@
             if g is None:
                 try:
                     g = open(tempname, 'w')
-                except IOError, msg:
+                except IOError as msg:
                     f.close()
                     err('%s: cannot create: %r\n' % (tempname, msg))
                     return 1
@@ -144,17 +144,17 @@
     try:
         statbuf = os.stat(filename)
         os.chmod(tempname, statbuf[ST_MODE] & 07777)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
     # Then make a backup of the original file as filename~
     try:
         os.rename(filename, filename + '~')
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: backup failed (%r)\n' % (filename, msg))
     # Now move the temp file to the original file
     try:
         os.rename(tempname, filename)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: rename failed (%r)\n' % (filename, msg))
         return 1
     # Return succes

Modified: python/branches/p3yk/Demo/scripts/ftpstats.py
==============================================================================
--- python/branches/p3yk/Demo/scripts/ftpstats.py	(original)
+++ python/branches/p3yk/Demo/scripts/ftpstats.py	Wed Jan 10 17:19:56 2007
@@ -25,7 +25,7 @@
     search = None
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'm:s:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print 'usage: ftpstats [-m maxitems] [file]'
         sys.exit(2)
@@ -41,7 +41,7 @@
     else:
         try:
             f = open(file, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print file, ':', msg
             sys.exit(1)
     bydate = {}

Modified: python/branches/p3yk/Demo/scripts/mboxconvert.py
==============================================================================
--- python/branches/p3yk/Demo/scripts/mboxconvert.py	(original)
+++ python/branches/p3yk/Demo/scripts/mboxconvert.py	Wed Jan 10 17:19:56 2007
@@ -16,7 +16,7 @@
     dofile = mmdf
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'f')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stderr.write('%s\n' % msg)
         sys.exit(2)
     for o, a in opts:
@@ -33,7 +33,7 @@
         elif os.path.isfile(arg):
             try:
                 f = open(arg)
-            except IOError, msg:
+            except IOError as msg:
                 sys.stderr.write('%s: %s\n' % (arg, msg))
                 sts = 1
                 continue
@@ -56,7 +56,7 @@
         fn = os.path.join(dir, msg)
         try:
             f = open(fn)
-        except IOError, msg:
+        except IOError as msg:
             sys.stderr.write('%s: %s\n' % (fn, msg))
             sts = 1
             continue

Modified: python/branches/p3yk/Demo/scripts/newslist.py
==============================================================================
--- python/branches/p3yk/Demo/scripts/newslist.py	(original)
+++ python/branches/p3yk/Demo/scripts/newslist.py	Wed Jan 10 17:19:56 2007
@@ -330,7 +330,7 @@
         else:
             s = NNTP(newshost)
         connected = 1
-    except (nntplib.error_temp, nntplib.error_perm), x:
+    except (nntplib.error_temp, nntplib.error_perm) as x:
         print 'Error connecting to host:', x
         print 'I\'ll try to use just the local list.'
         connected = 0

Modified: python/branches/p3yk/Demo/scripts/pp.py
==============================================================================
--- python/branches/p3yk/Demo/scripts/pp.py	(original)
+++ python/branches/p3yk/Demo/scripts/pp.py	Wed Jan 10 17:19:56 2007
@@ -35,7 +35,7 @@
 
 try:
     optlist, ARGS = getopt.getopt(sys.argv[1:], 'acde:F:np')
-except getopt.error, msg:
+except getopt.error as msg:
     sys.stderr.write(sys.argv[0] + ': ' + msg + '\n')
     sys.exit(2)
 

Modified: python/branches/p3yk/Demo/scripts/update.py
==============================================================================
--- python/branches/p3yk/Demo/scripts/update.py	(original)
+++ python/branches/p3yk/Demo/scripts/update.py	Wed Jan 10 17:19:56 2007
@@ -19,7 +19,7 @@
         self.changed = 0
         try:
             self.lines = open(filename, 'r').readlines()
-        except IOError, msg:
+        except IOError as msg:
             print '*** Can\'t open "%s":' % filename, msg
             self.lines = None
             return
@@ -32,7 +32,7 @@
         try:
             os.rename(self.filename, self.filename + '~')
             fp = open(self.filename, 'w')
-        except (os.error, IOError), msg:
+        except (os.error, IOError) as msg:
             print '*** Can\'t rewrite "%s":' % self.filename, msg
             return
         print 'writing', self.filename
@@ -67,7 +67,7 @@
     if sys.argv[1:]:
         try:
             fp = open(sys.argv[1], 'r')
-        except IOError, msg:
+        except IOError as msg:
             print 'Can\'t open "%s":' % sys.argv[1], msg
             sys.exit(1)
     else:

Modified: python/branches/p3yk/Demo/sockets/gopher.py
==============================================================================
--- python/branches/p3yk/Demo/sockets/gopher.py	(original)
+++ python/branches/p3yk/Demo/sockets/gopher.py	Wed Jan 10 17:19:56 2007
@@ -142,7 +142,7 @@
         raise RuntimeError, 'too many args'
     try:
         browse_menu(selector, host, port)
-    except socket.error, msg:
+    except socket.error as msg:
         print 'Socket error:', msg
         sys.exit(1)
     except KeyboardInterrupt:
@@ -202,7 +202,7 @@
         p = os.popen('${PAGER-more}', 'w')
         x = SaveLines(p)
         get_alt_textfile(selector, host, port, x.writeln)
-    except IOError, msg:
+    except IOError as msg:
         print 'IOError:', msg
     if x:
         x.close()
@@ -213,7 +213,7 @@
     try:
         get_alt_textfile(selector, host, port, x.writeln)
         print 'Done.'
-    except IOError, msg:
+    except IOError as msg:
         print 'IOError:', msg
     x.close()
 
@@ -311,7 +311,7 @@
         cmd = savefile[1:].strip()
         try:
             p = os.popen(cmd, 'w')
-        except IOError, msg:
+        except IOError as msg:
             print repr(cmd), ':', msg
             return None
         print 'Piping through', repr(cmd), '...'
@@ -320,7 +320,7 @@
         savefile = os.path.expanduser(savefile)
     try:
         f = open(savefile, 'w')
-    except IOError, msg:
+    except IOError as msg:
         print repr(savefile), ':', msg
         return None
     print 'Saving to', repr(savefile), '...'

Modified: python/branches/p3yk/Demo/sockets/telnet.py
==============================================================================
--- python/branches/p3yk/Demo/sockets/telnet.py	(original)
+++ python/branches/p3yk/Demo/sockets/telnet.py	Wed Jan 10 17:19:56 2007
@@ -52,7 +52,7 @@
     #
     try:
         s.connect((host, port))
-    except error, msg:
+    except error as msg:
         sys.stderr.write('connect failed: ' + repr(msg) + '\n')
         sys.exit(1)
     #

Modified: python/branches/p3yk/Demo/threads/find.py
==============================================================================
--- python/branches/p3yk/Demo/threads/find.py	(original)
+++ python/branches/p3yk/Demo/threads/find.py	Wed Jan 10 17:19:56 2007
@@ -131,7 +131,7 @@
 def find(dir, pred, wq):
     try:
         names = os.listdir(dir)
-    except os.error, msg:
+    except os.error as msg:
         print repr(dir), ':', msg
         return
     for name in names:
@@ -139,7 +139,7 @@
             fullname = os.path.join(dir, name)
             try:
                 stat = os.lstat(fullname)
-            except os.error, msg:
+            except os.error as msg:
                 print repr(fullname), ':', msg
                 continue
             if pred(dir, name, fullname, stat):

Modified: python/branches/p3yk/Demo/threads/telnet.py
==============================================================================
--- python/branches/p3yk/Demo/threads/telnet.py	(original)
+++ python/branches/p3yk/Demo/threads/telnet.py	Wed Jan 10 17:19:56 2007
@@ -56,7 +56,7 @@
     #
     try:
         s.connect((host, port))
-    except error, msg:
+    except error as msg:
         sys.stderr.write('connect failed: %r\n' % (msg,))
         sys.exit(1)
     #

Modified: python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py	Wed Jan 10 17:19:56 2007
@@ -156,7 +156,7 @@
             self.current = self.var.get()
             try:
                 self.dialog.widget.pack(**{self.option: self.current})
-            except TclError, msg:
+            except TclError as msg:
                 print msg
                 self.refresh()
 
@@ -212,7 +212,7 @@
                                      'pack',
                                      'info',
                                      self.widget))
-        except TclError, msg:
+        except TclError as msg:
             print msg
             return
         dict = {}
@@ -239,7 +239,7 @@
                         '-'+self.option,
                         self.dialog.master.tk.merge(
                                 self.current))
-            except TclError, msg:
+            except TclError as msg:
                 print msg
                 self.refresh()
 
@@ -285,7 +285,7 @@
             self.current = self.var.get()
             try:
                 self.dialog.widget[self.option] = self.current
-            except TclError, msg:
+            except TclError as msg:
                 print msg
                 self.refresh()
 
@@ -374,7 +374,7 @@
                     self.master.send(self.app,
                                      self.widget,
                                      'config'))
-        except TclError, msg:
+        except TclError as msg:
             print msg
             return
         dict = {}
@@ -398,7 +398,7 @@
                         'config',
                         '-'+self.option,
                         self.current)
-            except TclError, msg:
+            except TclError as msg:
                 print msg
                 self.refresh()
 
@@ -445,7 +445,7 @@
         if widget == '.': continue
         try:
             RemotePackDialog(list, list.app, widget)
-        except TclError, msg:
+        except TclError as msg:
             print msg
 
 test()

Modified: python/branches/p3yk/Demo/tkinter/guido/ManPage.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/ManPage.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/ManPage.py	Wed Jan 10 17:19:56 2007
@@ -95,7 +95,7 @@
             self._parseline('')
         try:
             self.tk.deletefilehandler(self.fp)
-        except TclError, msg:
+        except TclError as msg:
             pass
         self.fp.close()
         self.fp = None

Modified: python/branches/p3yk/Demo/tkinter/guido/mbox.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/mbox.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/mbox.py	Wed Jan 10 17:19:56 2007
@@ -27,7 +27,7 @@
     seq = 'all'
     try:
         opts, args = getopt.getopt(sys.argv[1:], '')
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         sys.exit(2)
     for arg in args:

Modified: python/branches/p3yk/Demo/tkinter/guido/tkman.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/tkman.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/tkman.py	Wed Jan 10 17:19:56 2007
@@ -216,7 +216,7 @@
                 prog = re.compile(search, map)
             else:
                 prog = re.compile(search)
-        except re.error, msg:
+        except re.error as msg:
             self.frame.bell()
             print 'Regex error:', msg
             return

Modified: python/branches/p3yk/Demo/tkinter/guido/wish.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/wish.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/wish.py	Wed Jan 10 17:19:56 2007
@@ -23,7 +23,7 @@
         tk.record(line)
         try:
             result = tk.call('eval', cmd)
-        except _tkinter.TclError, msg:
+        except _tkinter.TclError as msg:
             print 'TclError:', msg
         else:
             if result: print result

Modified: python/branches/p3yk/Doc/howto/urllib2.rst
==============================================================================
--- python/branches/p3yk/Doc/howto/urllib2.rst	(original)
+++ python/branches/p3yk/Doc/howto/urllib2.rst	Wed Jan 10 17:19:56 2007
@@ -214,7 +214,7 @@
 
     >>> req = urllib2.Request('http://www.pretend_server.org')
     >>> try: urllib2.urlopen(req)
-    >>> except URLError, e:
+    >>> except URLError as e:
     >>>    print e.reason
     >>>
     (4, 'getaddrinfo failed')
@@ -326,7 +326,7 @@
     >>> req = urllib2.Request('http://www.python.org/fish.html')
     >>> try: 
     >>>     urllib2.urlopen(req)
-    >>> except URLError, e:
+    >>> except URLError as e:
     >>>     print e.code
     >>>     print e.read()
     >>> 
@@ -354,10 +354,10 @@
     req = Request(someurl)
     try:
         response = urlopen(req)
-    except HTTPError, e:
+    except HTTPError as e:
         print 'The server couldn\'t fulfill the request.'
         print 'Error code: ', e.code
-    except URLError, e:
+    except URLError as e:
         print 'We failed to reach a server.'
         print 'Reason: ', e.reason
     else:
@@ -378,7 +378,7 @@
     req = Request(someurl)
     try:
         response = urlopen(req)
-    except URLError, e:
+    except URLError as e:
         if hasattr(e, 'reason'):
             print 'We failed to reach a server.'
             print 'Reason: ', e.reason

Modified: python/branches/p3yk/Doc/lib/email-unpack.py
==============================================================================
--- python/branches/p3yk/Doc/lib/email-unpack.py	(original)
+++ python/branches/p3yk/Doc/lib/email-unpack.py	Wed Jan 10 17:19:56 2007
@@ -35,7 +35,7 @@
 
     try:
         os.mkdir(opts.directory)
-    except OSError, e:
+    except OSError as e:
         # Ignore directory exists error
         if e.errno != errno.EEXIST:
             raise

Modified: python/branches/p3yk/Doc/lib/libcsv.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libcsv.tex	(original)
+++ python/branches/p3yk/Doc/lib/libcsv.tex	Wed Jan 10 17:19:56 2007
@@ -426,7 +426,7 @@
 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}
 

Modified: python/branches/p3yk/Doc/lib/libgetopt.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libgetopt.tex	(original)
+++ python/branches/p3yk/Doc/lib/libgetopt.tex	Wed Jan 10 17:19:56 2007
@@ -126,7 +126,7 @@
 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()

Modified: python/branches/p3yk/Doc/lib/libshutil.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libshutil.tex	(original)
+++ python/branches/p3yk/Doc/lib/libshutil.tex	Wed Jan 10 17:19:56 2007
@@ -144,6 +144,6 @@
                 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}

Modified: python/branches/p3yk/Doc/lib/libsocket.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libsocket.tex	(original)
+++ python/branches/p3yk/Doc/lib/libsocket.tex	Wed Jan 10 17:19:56 2007
@@ -813,13 +813,13 @@
     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 @@
     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

Modified: python/branches/p3yk/Doc/lib/libsubprocess.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libsubprocess.tex	(original)
+++ python/branches/p3yk/Doc/lib/libsubprocess.tex	Wed Jan 10 17:19:56 2007
@@ -284,7 +284,7 @@
         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}
 

Modified: python/branches/p3yk/Doc/lib/libxdrlib.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libxdrlib.tex	(original)
+++ python/branches/p3yk/Doc/lib/libxdrlib.tex	Wed Jan 10 17:19:56 2007
@@ -246,6 +246,6 @@
 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}

Modified: python/branches/p3yk/Doc/lib/libxmlrpclib.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libxmlrpclib.tex	(original)
+++ python/branches/p3yk/Doc/lib/libxmlrpclib.tex	Wed Jan 10 17:19:56 2007
@@ -358,7 +358,7 @@
 
 try:
     print server.examples.getStateName(41)
-except Error, v:
+except Error as v:
     print "ERROR", v
 \end{verbatim}
 

Modified: python/branches/p3yk/Doc/lib/sqlite3/complete_statement.py
==============================================================================
--- python/branches/p3yk/Doc/lib/sqlite3/complete_statement.py	(original)
+++ python/branches/p3yk/Doc/lib/sqlite3/complete_statement.py	Wed Jan 10 17:19:56 2007
@@ -23,7 +23,7 @@
 
             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 = ""
 

Modified: python/branches/p3yk/Doc/tools/findcsyms
==============================================================================
--- python/branches/p3yk/Doc/tools/findcsyms	(original)
+++ python/branches/p3yk/Doc/tools/findcsyms	Wed Jan 10 17:19:56 2007
@@ -127,7 +127,7 @@
                 print_list(undocumented, "Undocumented symbols")
         else:
             print_list(L)
-    except IOError, e:
+    except IOError as e:
         if e.errno != errno.EPIPE:
             raise
 

Modified: python/branches/p3yk/Doc/tools/listmodules
==============================================================================
--- python/branches/p3yk/Doc/tools/listmodules	(original)
+++ python/branches/p3yk/Doc/tools/listmodules	Wed Jan 10 17:19:56 2007
@@ -53,7 +53,7 @@
         opts, args = getopt.getopt(
             args, "abchi:",
             ["annotate", "built-in", "categorize", "help", "ignore-from="])
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stdout = sys.stderr
         print msg
         print

Modified: python/branches/p3yk/Doc/tools/mkhowto
==============================================================================
--- python/branches/p3yk/Doc/tools/mkhowto	(original)
+++ python/branches/p3yk/Doc/tools/mkhowto	Wed Jan 10 17:19:56 2007
@@ -599,7 +599,7 @@
     options = Options()
     try:
         args = options.parse(sys.argv[1:])
-    except getopt.error, msg:
+    except getopt.error as msg:
         error(options, msg)
     if not args:
         # attempt to locate single .tex file in current directory:

Modified: python/branches/p3yk/Doc/tools/mksourcepkg
==============================================================================
--- python/branches/p3yk/Doc/tools/mksourcepkg	(original)
+++ python/branches/p3yk/Doc/tools/mksourcepkg	Wed Jan 10 17:19:56 2007
@@ -45,7 +45,7 @@
           opts, args = getopt.getopt(sys.argv[1:], "Aabgtzq",
                                      ["all", "bzip2", "gzip", "tools", "zip",
                                       "quiet", "anonymous"])
-     except getopt.error, e:
+     except getopt.error as e:
           usage(warning=str(e))
           sys.exit(2)
      if len(args) not in (1, 2):

Modified: python/branches/p3yk/Doc/tools/prechm.py
==============================================================================
--- python/branches/p3yk/Doc/tools/prechm.py	(original)
+++ python/branches/p3yk/Doc/tools/prechm.py	Wed Jan 10 17:19:56 2007
@@ -448,7 +448,7 @@
 def openfile(file):
     try:
         p = open(file, "w")
-    except IOError, msg:
+    except IOError as msg:
         print file, ":", msg
         sys.exit(1)
     return p
@@ -466,7 +466,7 @@
 
     try:
         optlist, args = getopt.getopt(args, 'ckpv:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         usage()
 

Modified: python/branches/p3yk/Doc/tools/sgmlconv/docfixer.py
==============================================================================
--- python/branches/p3yk/Doc/tools/sgmlconv/docfixer.py	(original)
+++ python/branches/p3yk/Doc/tools/sgmlconv/docfixer.py	Wed Jan 10 17:19:56 2007
@@ -1039,7 +1039,8 @@
     #
     try:
         write_esis(fragment, ofp, knownempty)
-    except IOError, (err, msg):
+    except IOError as e:
+        (err, msg) = e
         # Ignore EPIPE; it just means that whoever we're writing to stopped
         # reading.  The rest of the output would be ignored.  All other errors
         # should still be reported,

Modified: python/branches/p3yk/Doc/tools/sgmlconv/esis2sgml.py
==============================================================================
--- python/branches/p3yk/Doc/tools/sgmlconv/esis2sgml.py	(original)
+++ python/branches/p3yk/Doc/tools/sgmlconv/esis2sgml.py	Wed Jan 10 17:19:56 2007
@@ -255,7 +255,8 @@
         if xml and xmldecl:
             opf.write('<?xml version="1.0" encoding="iso8859-1"?>\n')
         convert(ifp, ofp, xml=xml, autoclose=autoclose, verbatims=verbatims)
-    except IOError, (err, msg):
+    except IOError as e:
+        (err, msg) = e
         if err != errno.EPIPE:
             raise
 

Modified: python/branches/p3yk/Doc/tools/sgmlconv/esistools.py
==============================================================================
--- python/branches/p3yk/Doc/tools/sgmlconv/esistools.py	(original)
+++ python/branches/p3yk/Doc/tools/sgmlconv/esistools.py	Wed Jan 10 17:19:56 2007
@@ -139,7 +139,7 @@
     def _get_token(self, fp):
         try:
             line = fp.readline()
-        except IOError, e:
+        except IOError as e:
             e = SAXException("I/O error reading input stream", e)
             self.getErrorHandler().fatalError(e)
             return

Modified: python/branches/p3yk/Doc/tools/sgmlconv/latex2esis.py
==============================================================================
--- python/branches/p3yk/Doc/tools/sgmlconv/latex2esis.py	(original)
+++ python/branches/p3yk/Doc/tools/sgmlconv/latex2esis.py	Wed Jan 10 17:19:56 2007
@@ -397,7 +397,8 @@
     c = Conversion(ifp, ofp, table)
     try:
         c.convert()
-    except IOError, (err, msg):
+    except IOError as e:
+        (err, msg) = e
         if err != errno.EPIPE:
             raise
 

Modified: python/branches/p3yk/Doc/tut/tut.tex
==============================================================================
--- python/branches/p3yk/Doc/tut/tut.tex	(original)
+++ python/branches/p3yk/Doc/tut/tut.tex	Wed Jan 10 17:19:56 2007
@@ -3480,8 +3480,9 @@
     f = open('myfile.txt')
     s = f.readline()
     i = int(s.strip())
-except IOError, (errno, strerror):
-    print "I/O error(%s): %s" % (errno, strerror)
+except IOError as e:
+    (errno, strerror) = e
+    print "I/O error(%s): %s" % (e.errno, e.strerror)
 except ValueError:
     print "Could not convert data to an integer."
 except:
@@ -3530,7 +3531,7 @@
 \begin{verbatim}
 >>> try:
 ...    raise Exception('spam', 'eggs')
-... except Exception, inst:
+... except Exception as inst:
 ...    print type(inst)     # the exception instance
 ...    print inst.args      # arguments stored in .args
 ...    print inst           # __str__ allows args to printed directly
@@ -3559,7 +3560,7 @@
 ... 
 >>> try:
 ...     this_fails()
-... except ZeroDivisionError, detail:
+... except ZeroDivisionError as detail:
 ...     print 'Handling run-time error:', detail
 ... 
 Handling run-time error: integer division or modulo by zero
@@ -3619,7 +3620,7 @@
 ... 
 >>> try:
 ...     raise MyError(2*2)
-... except MyError, e:
+... except MyError as e:
 ...     print 'My exception occurred, value:', e.value
 ... 
 My exception occurred, value: 4

Modified: python/branches/p3yk/Grammar/Grammar
==============================================================================
--- python/branches/p3yk/Grammar/Grammar	(original)
+++ python/branches/p3yk/Grammar/Grammar	Wed Jan 10 17:19:56 2007
@@ -79,7 +79,7 @@
 with_stmt: 'with' test [ with_var ] ':' suite
 with_var: 'as' expr
 # NB compile.c makes sure that the default except clause is last
-except_clause: 'except' [test [',' test]]
+except_clause: 'except' [test ['as' test]]
 suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
 
 # Backward compatibility cruft to support:

Modified: python/branches/p3yk/Lib/CGIHTTPServer.py
==============================================================================
--- python/branches/p3yk/Lib/CGIHTTPServer.py	(original)
+++ python/branches/p3yk/Lib/CGIHTTPServer.py	Wed Jan 10 17:19:56 2007
@@ -320,7 +320,7 @@
                     sys.stdout = save_stdout
                     sys.stderr = save_stderr
                     os.chdir(save_cwd)
-            except SystemExit, sts:
+            except SystemExit as sts:
                 self.log_error("CGI script exit status %s", str(sts))
             else:
                 self.log_message("CGI script exited OK")

Modified: python/branches/p3yk/Lib/ConfigParser.py
==============================================================================
--- python/branches/p3yk/Lib/ConfigParser.py	(original)
+++ python/branches/p3yk/Lib/ConfigParser.py	Wed Jan 10 17:19:56 2007
@@ -567,7 +567,7 @@
                 value = self._KEYCRE.sub(self._interpolation_replace, value)
                 try:
                     value = value % vars
-                except KeyError, e:
+                except KeyError as e:
                     raise InterpolationMissingOptionError(
                         option, section, rawval, e[0])
             else:

Modified: python/branches/p3yk/Lib/SimpleXMLRPCServer.py
==============================================================================
--- python/branches/p3yk/Lib/SimpleXMLRPCServer.py	(original)
+++ python/branches/p3yk/Lib/SimpleXMLRPCServer.py	Wed Jan 10 17:19:56 2007
@@ -259,7 +259,7 @@
             response = (response,)
             response = xmlrpclib.dumps(response, methodresponse=1,
                                        allow_none=self.allow_none, encoding=self.encoding)
-        except Fault, fault:
+        except Fault as fault:
             response = xmlrpclib.dumps(fault, allow_none=self.allow_none,
                                        encoding=self.encoding)
         except:
@@ -359,7 +359,7 @@
                 # XXX A marshalling error in any response will fail the entire
                 # multicall. If someone cares they should fix this.
                 results.append([self._dispatch(method_name, params)])
-            except Fault, fault:
+            except Fault as fault:
                 results.append(
                     {'faultCode' : fault.faultCode,
                      'faultString' : fault.faultString}

Modified: python/branches/p3yk/Lib/_strptime.py
==============================================================================
--- python/branches/p3yk/Lib/_strptime.py	(original)
+++ python/branches/p3yk/Lib/_strptime.py	Wed Jan 10 17:19:56 2007
@@ -291,7 +291,7 @@
                 format_regex = time_re.compile(format)
             # KeyError raised when a bad format is found; can be specified as
             # \\, in which case it was a stray % but with a space after it
-            except KeyError, err:
+            except KeyError as err:
                 bad_directive = err.args[0]
                 if bad_directive == "\\":
                     bad_directive = "%"

Modified: python/branches/p3yk/Lib/asynchat.py
==============================================================================
--- python/branches/p3yk/Lib/asynchat.py	(original)
+++ python/branches/p3yk/Lib/asynchat.py	Wed Jan 10 17:19:56 2007
@@ -87,7 +87,7 @@
 
         try:
             data = self.recv (self.ac_in_buffer_size)
-        except socket.error, why:
+        except socket.error as why:
             self.handle_error()
             return
 
@@ -220,7 +220,7 @@
                 if num_sent:
                     self.ac_out_buffer = self.ac_out_buffer[num_sent:]
 
-            except socket.error, why:
+            except socket.error as why:
                 self.handle_error()
                 return
 

Modified: python/branches/p3yk/Lib/asyncore.py
==============================================================================
--- python/branches/p3yk/Lib/asyncore.py	(original)
+++ python/branches/p3yk/Lib/asyncore.py	Wed Jan 10 17:19:56 2007
@@ -119,7 +119,7 @@
         else:
             try:
                 r, w, e = select.select(r, w, e, timeout)
-            except select.error, err:
+            except select.error as err:
                 if err[0] != EINTR:
                     raise
                 else:
@@ -165,7 +165,7 @@
                 pollster.register(fd, flags)
         try:
             r = pollster.poll(timeout)
-        except select.error, err:
+        except select.error as err:
             if err[0] != EINTR:
                 raise
             r = []
@@ -320,7 +320,7 @@
         try:
             conn, addr = self.socket.accept()
             return conn, addr
-        except socket.error, why:
+        except socket.error as why:
             if why[0] == EWOULDBLOCK:
                 pass
             else:
@@ -330,7 +330,7 @@
         try:
             result = self.socket.send(data)
             return result
-        except socket.error, why:
+        except socket.error as why:
             if why[0] == EWOULDBLOCK:
                 return 0
             else:
@@ -347,7 +347,7 @@
                 return ''
             else:
                 return data
-        except socket.error, why:
+        except socket.error as why:
             # winsock sometimes throws ENOTCONN
             if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]:
                 self.handle_close()

Modified: python/branches/p3yk/Lib/base64.py
==============================================================================
--- python/branches/p3yk/Lib/base64.py	(original)
+++ python/branches/p3yk/Lib/base64.py	Wed Jan 10 17:19:56 2007
@@ -71,7 +71,7 @@
         s = _translate(s, {altchars[0]: '+', altchars[1]: '/'})
     try:
         return binascii.a2b_base64(s)
-    except binascii.Error, msg:
+    except binascii.Error as msg:
         # Transform this exception for consistency
         raise TypeError(msg)
 
@@ -328,7 +328,7 @@
     import sys, getopt
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'deut')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stdout = sys.stderr
         print msg
         print """usage: %s [-d|-e|-u|-t] [file|-]

Modified: python/branches/p3yk/Lib/bsddb/dbtables.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/dbtables.py	(original)
+++ python/branches/p3yk/Lib/bsddb/dbtables.py	Wed Jan 10 17:19:56 2007
@@ -260,7 +260,7 @@
 
             txn.commit()
             txn = None
-        except DBError, dberror:
+        except DBError as dberror:
             if txn:
                 txn.abort()
             raise TableDBError, dberror[1]
@@ -338,7 +338,7 @@
                 txn = None
 
                 self.__load_column_info(table)
-            except DBError, dberror:
+            except DBError as dberror:
                 if txn:
                     txn.abort()
                 raise TableDBError, dberror[1]
@@ -407,7 +407,7 @@
             txn.commit()
             txn = None
 
-        except DBError, dberror:
+        except DBError as dberror:
             # WIBNI we could just abort the txn and re-raise the exception?
             # But no, because TableDBError is not related to DBError via
             # inheritance, so it would be backwards incompatible.  Do the next
@@ -466,7 +466,7 @@
                         txn.abort()
                     raise
 
-        except DBError, dberror:
+        except DBError as dberror:
             raise TableDBError, dberror[1]
 
     def Delete(self, table, conditions={}):
@@ -502,11 +502,11 @@
                         pass
                     txn.commit()
                     txn = None
-                except DBError, dberror:
+                except DBError as dberror:
                     if txn:
                         txn.abort()
                     raise
-        except DBError, dberror:
+        except DBError as dberror:
             raise TableDBError, dberror[1]
 
 
@@ -526,7 +526,7 @@
             if columns is None:
                 columns = self.__tablecolumns[table]
             matching_rowids = self.__Select(table, columns, conditions)
-        except DBError, dberror:
+        except DBError as dberror:
             raise TableDBError, dberror[1]
         # return the matches as a list of dictionaries
         return matching_rowids.values()
@@ -616,7 +616,7 @@
 
                     key, data = cur.next()
 
-            except DBError, dberror:
+            except DBError as dberror:
                 if dberror[0] != DB_NOTFOUND:
                     raise
                 continue
@@ -636,7 +636,7 @@
                     try:
                         rowdata[column] = self.db.get(
                             _data_key(table, column, rowid))
-                    except DBError, dberror:
+                    except DBError as dberror:
                         if dberror[0] != DB_NOTFOUND:
                             raise
                         rowdata[column] = None
@@ -700,7 +700,7 @@
             if table in self.__tablecolumns:
                 del self.__tablecolumns[table]
 
-        except DBError, dberror:
+        except DBError as dberror:
             if txn:
                 txn.abort()
             raise TableDBError, dberror[1]

Modified: python/branches/p3yk/Lib/bsddb/test/test_basics.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_basics.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_basics.py	Wed Jan 10 17:19:56 2007
@@ -58,7 +58,7 @@
             self.homeDir = homeDir
             try:
                 shutil.rmtree(homeDir)
-            except OSError, e:
+            except OSError as e:
                 # unix returns ENOENT, windows returns ESRCH
                 if e.errno not in (errno.ENOENT, errno.ESRCH): raise
             os.mkdir(homeDir)
@@ -162,7 +162,7 @@
         # set_get_returns_none() to change it.
         try:
             d.delete('abcd')
-        except db.DBNotFoundError, val:
+        except db.DBNotFoundError as val:
             assert val[0] == db.DB_NOTFOUND
             if verbose: print val
         else:
@@ -181,7 +181,7 @@
 
         try:
             d.put('abcd', 'this should fail', flags=db.DB_NOOVERWRITE)
-        except db.DBKeyExistError, val:
+        except db.DBKeyExistError as val:
             assert val[0] == db.DB_KEYEXIST
             if verbose: print val
         else:
@@ -313,7 +313,7 @@
                 print rec
             try:
                 rec = c.next()
-            except db.DBNotFoundError, val:
+            except db.DBNotFoundError as val:
                 if get_raises_error:
                     assert val[0] == db.DB_NOTFOUND
                     if verbose: print val
@@ -333,7 +333,7 @@
                 print rec
             try:
                 rec = c.prev()
-            except db.DBNotFoundError, val:
+            except db.DBNotFoundError as val:
                 if get_raises_error:
                     assert val[0] == db.DB_NOTFOUND
                     if verbose: print val
@@ -357,7 +357,7 @@
 
         try:
             n = c.set('bad key')
-        except db.DBNotFoundError, val:
+        except db.DBNotFoundError as val:
             assert val[0] == db.DB_NOTFOUND
             if verbose: print val
         else:
@@ -371,7 +371,7 @@
 
         try:
             n = c.get_both('0404', 'bad data')
-        except db.DBNotFoundError, val:
+        except db.DBNotFoundError as val:
             assert val[0] == db.DB_NOTFOUND
             if verbose: print val
         else:
@@ -399,7 +399,7 @@
         c.delete()
         try:
             rec = c.current()
-        except db.DBKeyEmptyError, val:
+        except db.DBKeyEmptyError as val:
             if get_raises_error:
                 assert val[0] == db.DB_KEYEMPTY
                 if verbose: print val
@@ -445,7 +445,7 @@
                           method
                 # a bug may cause a NULL pointer dereference...
                 getattr(c, method)(*args)
-            except db.DBError, val:
+            except db.DBError as val:
                 assert val[0] == 0
                 if verbose: print val
             else:
@@ -730,7 +730,7 @@
         txn.abort()
         try:
             txn.abort()
-        except db.DBError, e:
+        except db.DBError as e:
             pass
         else:
             raise RuntimeError, "DBTxn.abort() called after DB_TXN no longer valid w/o an exception"
@@ -739,7 +739,7 @@
         txn.commit()
         try:
             txn.commit()
-        except db.DBError, e:
+        except db.DBError as e:
             pass
         else:
             raise RuntimeError, "DBTxn.commit() called after DB_TXN no longer valid w/o an exception"

Modified: python/branches/p3yk/Lib/bsddb/test/test_compare.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_compare.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_compare.py	Wed Jan 10 17:19:56 2007
@@ -234,7 +234,7 @@
             self.db.set_bt_compare (my_compare)
             assert False, "this set should fail"
 
-        except RuntimeError, msg:
+        except RuntimeError as msg:
             pass
 
 def test_suite ():

Modified: python/branches/p3yk/Lib/bsddb/test/test_pickle.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_pickle.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_pickle.py	Wed Jan 10 17:19:56 2007
@@ -11,7 +11,7 @@
 try:
     # For Pythons w/distutils pybsddb
     from bsddb3 import db
-except ImportError, e:
+except ImportError as e:
     # For Python 2.3
     from bsddb import db
 
@@ -47,7 +47,7 @@
         assert self.db['spam'] == 'eggs'
         try:
             self.db.put('spam', 'ham', flags=db.DB_NOOVERWRITE)
-        except db.DBError, egg:
+        except db.DBError as egg:
             pickledEgg = pickle.dumps(egg)
             #print repr(pickledEgg)
             rottenEgg = pickle.loads(pickledEgg)

Modified: python/branches/p3yk/Lib/bsddb/test/test_recno.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_recno.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_recno.py	Wed Jan 10 17:19:56 2007
@@ -29,7 +29,7 @@
     def tearDown(self):
         try:
             os.remove(self.filename)
-        except OSError, e:
+        except OSError as e:
             if e.errno != errno.EEXIST: raise
 
     def test01_basic(self):
@@ -63,7 +63,7 @@
 
         try:
             data = d[0]  # This should raise a KeyError!?!?!
-        except db.DBInvalidArgError, val:
+        except db.DBInvalidArgError as val:
             assert val[0] == db.EINVAL
             if verbose: print val
         else:
@@ -72,7 +72,7 @@
         # test that has_key raises DB exceptions (fixed in pybsddb 4.3.2)
         try:
             d.has_key(0)
-        except db.DBError, val:
+        except db.DBError as val:
             pass
         else:
             self.fail("has_key did not raise a proper exception")
@@ -86,7 +86,7 @@
 
         try:
             data = d.get(100)
-        except db.DBNotFoundError, val:
+        except db.DBNotFoundError as val:
             if get_returns_none:
                 self.fail("unexpected exception")
         else:
@@ -177,7 +177,7 @@
 
         try:
             d.get(99)
-        except db.DBKeyEmptyError, val:
+        except db.DBKeyEmptyError as val:
             if get_returns_none:
                 self.fail("unexpected DBKeyEmptyError exception")
             else:
@@ -267,7 +267,7 @@
 
         try:                    # this one will fail
             d.append('bad' * 20)
-        except db.DBInvalidArgError, val:
+        except db.DBInvalidArgError as val:
             assert val[0] == db.EINVAL
             if verbose: print val
         else:

Modified: python/branches/p3yk/Lib/bsddb/test/test_thread.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_thread.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_thread.py	Wed Jan 10 17:19:56 2007
@@ -57,7 +57,7 @@
         self.homeDir = homeDir
         try:
             os.mkdir(homeDir)
-        except OSError, e:
+        except OSError as e:
             if e.errno != errno.EEXIST: raise
         self.env = db.DBEnv()
         self.setEnvOpts()
@@ -247,7 +247,7 @@
         # flush them
         try:
             dbutils.DeadlockWrap(d.sync, max_retries=12)
-        except db.DBIncompleteError, val:
+        except db.DBIncompleteError as val:
             if verbose:
                 print "could not complete sync()..."
 
@@ -360,7 +360,7 @@
                         print "%s: records %d - %d finished" % (name, start, x)
                 txn.commit()
                 finished = True
-            except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val:
+            except (db.DBLockDeadlockError, db.DBLockNotGrantedError) as val:
                 if verbose:
                     print "%s: Aborting transaction (%s)" % (name, val[1])
                 txn.abort()
@@ -398,7 +398,7 @@
                 finished = True
                 if verbose:
                     print "%s: deleted records %s" % (name, recs)
-            except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val:
+            except (db.DBLockDeadlockError, db.DBLockNotGrantedError) as val:
                 if verbose:
                     print "%s: Aborting transaction (%s)" % (name, val[1])
                 txn.abort()
@@ -428,7 +428,7 @@
                     c.close()
                     txn.commit()
                     finished = True
-                except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val:
+                except (db.DBLockDeadlockError, db.DBLockNotGrantedError) as val:
                     if verbose:
                         print "%s: Aborting transaction (%s)" % (name, val[1])
                     c.close()

Modified: python/branches/p3yk/Lib/cgi.py
==============================================================================
--- python/branches/p3yk/Lib/cgi.py	(original)
+++ python/branches/p3yk/Lib/cgi.py	Wed Jan 10 17:19:56 2007
@@ -982,7 +982,7 @@
     print "<H3>Current Working Directory:</H3>"
     try:
         pwd = os.getcwd()
-    except os.error, msg:
+    except os.error as msg:
         print "os.error:", escape(str(msg))
     else:
         print escape(pwd)

Modified: python/branches/p3yk/Lib/codecs.py
==============================================================================
--- python/branches/p3yk/Lib/codecs.py	(original)
+++ python/branches/p3yk/Lib/codecs.py	Wed Jan 10 17:19:56 2007
@@ -13,7 +13,7 @@
 
 try:
     from _codecs import *
-except ImportError, why:
+except ImportError as why:
     raise SystemError('Failed to load the builtin codecs: %s' % why)
 
 __all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE",
@@ -422,7 +422,7 @@
             data = self.bytebuffer + newdata
             try:
                 newchars, decodedbytes = self.decode(data, self.errors)
-            except UnicodeDecodeError, exc:
+            except UnicodeDecodeError as exc:
                 if firstline:
                     newchars, decodedbytes = self.decode(data[:exc.start], self.errors)
                     lines = newchars.splitlines(True)

Modified: python/branches/p3yk/Lib/codeop.py
==============================================================================
--- python/branches/p3yk/Lib/codeop.py	(original)
+++ python/branches/p3yk/Lib/codeop.py	Wed Jan 10 17:19:56 2007
@@ -80,18 +80,18 @@
 
     try:
         code = compiler(source, filename, symbol)
-    except SyntaxError, err:
+    except SyntaxError as err:
         pass
 
     try:
         code1 = compiler(source + "\n", filename, symbol)
-    except SyntaxError, err1:
-        pass
+    except SyntaxError as e:
+        err1 = e
 
     try:
         code2 = compiler(source + "\n\n", filename, symbol)
-    except SyntaxError, err2:
-        pass
+    except SyntaxError as e:
+        err2 = e
 
     if code:
         return code

Modified: python/branches/p3yk/Lib/compileall.py
==============================================================================
--- python/branches/p3yk/Lib/compileall.py	(original)
+++ python/branches/p3yk/Lib/compileall.py	Wed Jan 10 17:19:56 2007
@@ -65,12 +65,12 @@
                     ok = py_compile.compile(fullname, None, dfile, True)
                 except KeyboardInterrupt:
                     raise KeyboardInterrupt
-                except py_compile.PyCompileError,err:
+                except py_compile.PyCompileError as err:
                     if quiet:
                         print 'Compiling', fullname, '...'
                     print err.msg
                     success = 0
-                except IOError, e:
+                except IOError as e:
                     print "Sorry", e
                     success = 0
                 else:
@@ -109,7 +109,7 @@
     import getopt
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
               "[-x regexp] [directory ...]"

Modified: python/branches/p3yk/Lib/compiler/pycodegen.py
==============================================================================
--- python/branches/p3yk/Lib/compiler/pycodegen.py	(original)
+++ python/branches/p3yk/Lib/compiler/pycodegen.py	Wed Jan 10 17:19:56 2007
@@ -227,7 +227,7 @@
             assert getattr(self, 'NameFinder')
             assert getattr(self, 'FunctionGen')
             assert getattr(self, 'ClassGen')
-        except AssertionError, msg:
+        except AssertionError as msg:
             intro = "Bad class construction for %s" % self.__class__.__name__
             raise AssertionError, intro
 

Modified: python/branches/p3yk/Lib/contextlib.py
==============================================================================
--- python/branches/p3yk/Lib/contextlib.py	(original)
+++ python/branches/p3yk/Lib/contextlib.py	Wed Jan 10 17:19:56 2007
@@ -28,7 +28,7 @@
             try:
                 self.gen.throw(type, value, traceback)
                 raise RuntimeError("generator didn't stop after throw()")
-            except StopIteration, exc:
+            except StopIteration as exc:
                 # Suppress the exception *unless* it's the same exception that
                 # was passed to throw().  This prevents a StopIteration
                 # raised inside the "with" statement from being suppressed

Modified: python/branches/p3yk/Lib/csv.py
==============================================================================
--- python/branches/p3yk/Lib/csv.py	(original)
+++ python/branches/p3yk/Lib/csv.py	Wed Jan 10 17:19:56 2007
@@ -48,7 +48,7 @@
     def _validate(self):
         try:
             _Dialect(self)
-        except TypeError, e:
+        except TypeError as e:
             # We do this for compatibility with py2.3
             raise Error(str(e))
 

Modified: python/branches/p3yk/Lib/ctypes/macholib/dyld.py
==============================================================================
--- python/branches/p3yk/Lib/ctypes/macholib/dyld.py	(original)
+++ python/branches/p3yk/Lib/ctypes/macholib/dyld.py	Wed Jan 10 17:19:56 2007
@@ -148,7 +148,7 @@
     """
     try:
         return dyld_find(fn, executable_path=executable_path, env=env)
-    except ValueError, e:
+    except ValueError as e:
         pass
     fmwk_index = fn.rfind('.framework')
     if fmwk_index == -1:

Modified: python/branches/p3yk/Lib/ctypes/test/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/ctypes/test/__init__.py	(original)
+++ python/branches/p3yk/Lib/ctypes/test/__init__.py	Wed Jan 10 17:19:56 2007
@@ -57,12 +57,12 @@
     for modname in find_package_modules(package, mask):
         try:
             mod = __import__(modname, globals(), locals(), ['*'])
-        except ResourceDenied, detail:
+        except ResourceDenied as detail:
             skipped.append(modname)
             if verbosity > 1:
                 print >> sys.stderr, "Skipped %s: %s" % (modname, detail)
             continue
-        except Exception, detail:
+        except Exception as detail:
             print >> sys.stderr, "Warning: could not import %s: %s" % (modname, detail)
             continue
         for name in dir(mod):

Modified: python/branches/p3yk/Lib/ctypes/test/test_bitfields.py
==============================================================================
--- python/branches/p3yk/Lib/ctypes/test/test_bitfields.py	(original)
+++ python/branches/p3yk/Lib/ctypes/test/test_bitfields.py	Wed Jan 10 17:19:56 2007
@@ -191,7 +191,7 @@
     def get_except(self, func, *args, **kw):
         try:
             func(*args, **kw)
-        except Exception, detail:
+        except Exception as detail:
             return detail.__class__, str(detail)
 
     def test_mixed_1(self):

Modified: python/branches/p3yk/Lib/ctypes/test/test_structures.py
==============================================================================
--- python/branches/p3yk/Lib/ctypes/test/test_structures.py	(original)
+++ python/branches/p3yk/Lib/ctypes/test/test_structures.py	Wed Jan 10 17:19:56 2007
@@ -313,7 +313,7 @@
     def get_except(self, func, *args):
         try:
             func(*args)
-        except Exception, detail:
+        except Exception as detail:
             return detail.__class__, str(detail)
 
 
@@ -388,7 +388,7 @@
 
         try:
             Recursive._fields_ = [("next", Recursive)]
-        except AttributeError, details:
+        except AttributeError as details:
             self.failUnless("Structure or union cannot contain itself" in
                             str(details))
         else:
@@ -405,7 +405,7 @@
 
         try:
             Second._fields_ = [("first", First)]
-        except AttributeError, details:
+        except AttributeError as details:
             self.failUnless("_fields_ is final" in
                             str(details))
         else:

Modified: python/branches/p3yk/Lib/ctypes/util.py
==============================================================================
--- python/branches/p3yk/Lib/ctypes/util.py	(original)
+++ python/branches/p3yk/Lib/ctypes/util.py	Wed Jan 10 17:19:56 2007
@@ -60,12 +60,12 @@
         finally:
             try:
                 os.unlink(outfile)
-            except OSError, e:
+            except OSError as e:
                 if e.errno != errno.ENOENT:
                     raise
             try:
                 os.unlink(ccout)
-            except OSError, e:
+            except OSError as e:
                 if e.errno != errno.ENOENT:
                     raise
         res = re.search(expr, trace)

Modified: python/branches/p3yk/Lib/dis.py
==============================================================================
--- python/branches/p3yk/Lib/dis.py	(original)
+++ python/branches/p3yk/Lib/dis.py	Wed Jan 10 17:19:56 2007
@@ -33,7 +33,7 @@
                 print "Disassembly of %s:" % name
                 try:
                     dis(x1)
-                except TypeError, msg:
+                except TypeError as msg:
                     print "Sorry:", msg
                 print
     elif hasattr(x, 'co_code'):

Modified: python/branches/p3yk/Lib/distutils/bcppcompiler.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/bcppcompiler.py	(original)
+++ python/branches/p3yk/Lib/distutils/bcppcompiler.py	Wed Jan 10 17:19:56 2007
@@ -115,7 +115,7 @@
                 # This needs to be compiled to a .res file -- do it now.
                 try:
                     self.spawn (["brcc32", "-fo", obj, src])
-                except DistutilsExecError, msg:
+                except DistutilsExecError as msg:
                     raise CompileError, msg
                 continue # the 'for' loop
 
@@ -139,7 +139,7 @@
                 self.spawn ([self.cc] + compile_opts + pp_opts +
                             [input_opt, output_opt] +
                             extra_postargs + [src])
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
 
         return objects
@@ -164,7 +164,7 @@
                 pass                    # XXX what goes here?
             try:
                 self.spawn ([self.lib] + lib_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise LibError, msg
         else:
             log.debug("skipping %s (up-to-date)", output_filename)
@@ -298,7 +298,7 @@
             self.mkpath (os.path.dirname (output_filename))
             try:
                 self.spawn ([self.linker] + ld_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise LinkError, msg
 
         else:
@@ -391,7 +391,7 @@
                 self.mkpath(os.path.dirname(output_file))
             try:
                 self.spawn(pp_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 print msg
                 raise CompileError, msg
 

Modified: python/branches/p3yk/Lib/distutils/command/register.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/command/register.py	(original)
+++ python/branches/p3yk/Lib/distutils/command/register.py	Wed Jan 10 17:19:56 2007
@@ -284,11 +284,11 @@
         data = ''
         try:
             result = opener.open(req)
-        except urllib2.HTTPError, e:
+        except urllib2.HTTPError as e:
             if self.show_response:
                 data = e.fp.read()
             result = e.code, e.msg
-        except urllib2.URLError, e:
+        except urllib2.URLError as e:
             result = 500, str(e)
         else:
             if self.show_response:

Modified: python/branches/p3yk/Lib/distutils/command/sdist.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/command/sdist.py	(original)
+++ python/branches/p3yk/Lib/distutils/command/sdist.py	Wed Jan 10 17:19:56 2007
@@ -333,7 +333,7 @@
 
             try:
                 self.filelist.process_template_line(line)
-            except DistutilsTemplateError, msg:
+            except DistutilsTemplateError as msg:
                 self.warn("%s, line %d: %s" % (template.filename,
                                                template.current_line,
                                                msg))

Modified: python/branches/p3yk/Lib/distutils/command/upload.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/command/upload.py	(original)
+++ python/branches/p3yk/Lib/distutils/command/upload.py	Wed Jan 10 17:19:56 2007
@@ -184,7 +184,7 @@
             http.putheader('Authorization', auth)
             http.endheaders()
             http.send(body)
-        except socket.error, e:
+        except socket.error as e:
             self.announce(str(e), log.ERROR)
             return
 

Modified: python/branches/p3yk/Lib/distutils/core.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/core.py	(original)
+++ python/branches/p3yk/Lib/distutils/core.py	Wed Jan 10 17:19:56 2007
@@ -110,7 +110,7 @@
     # (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 @@
     # 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 @@
             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 @@
                 raise SystemExit, error
 
         except (DistutilsError,
-                CCompilerError), msg:
+                CCompilerError) as msg:
             if DEBUG:
                 raise
             else:

Modified: python/branches/p3yk/Lib/distutils/cygwinccompiler.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/cygwinccompiler.py	(original)
+++ python/branches/p3yk/Lib/distutils/cygwinccompiler.py	Wed Jan 10 17:19:56 2007
@@ -142,13 +142,13 @@
             # gcc needs '.res' and '.rc' compiled to object files !!!
             try:
                 self.spawn(["windres", "-i", src, "-o", obj])
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
         else: # for other files use the C-compiler
             try:
                 self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
                            extra_postargs)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
 
     def link (self,
@@ -379,7 +379,7 @@
         s = f.read()
         f.close()
 
-    except IOError, exc:
+    except IOError as exc:
         # if we can't read this file, we cannot say it is wrong
         # the compiler will complain later about this file as missing
         return (CONFIG_H_UNCERTAIN,

Modified: python/branches/p3yk/Lib/distutils/dir_util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/dir_util.py	(original)
+++ python/branches/p3yk/Lib/distutils/dir_util.py	Wed Jan 10 17:19:56 2007
@@ -75,7 +75,7 @@
             try:
                 os.mkdir(head)
                 created_dirs.append(head)
-            except OSError, exc:
+            except OSError as exc:
                 raise DistutilsFileError, \
                       "could not create '%s': %s" % (head, exc[-1])
 
@@ -142,7 +142,8 @@
               "cannot copy tree '%s': not a directory" % src
     try:
         names = os.listdir(src)
-    except os.error, (errno, errstr):
+    except os.error as e:
+        (errno, errstr) = e
         if dry_run:
             names = []
         else:
@@ -209,7 +210,7 @@
             abspath = os.path.abspath(cmd[1])
             if abspath in _path_created:
                 del _path_created[abspath]
-        except (IOError, OSError), exc:
+        except (IOError, OSError) as exc:
             log.warn(grok_environment_error(
                     exc, "error removing %s: " % directory))
 

Modified: python/branches/p3yk/Lib/distutils/dist.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/dist.py	(original)
+++ python/branches/p3yk/Lib/distutils/dist.py	Wed Jan 10 17:19:56 2007
@@ -398,7 +398,7 @@
                         setattr(self, opt, strtobool(val))
                     else:
                         setattr(self, opt, val)
-                except ValueError, msg:
+                except ValueError as msg:
                     raise DistutilsOptionError, msg
 
     # parse_config_files ()
@@ -515,7 +515,7 @@
         # it takes.
         try:
             cmd_class = self.get_command_class(command)
-        except DistutilsModuleError, msg:
+        except DistutilsModuleError as msg:
             raise DistutilsArgError, msg
 
         # Require that the command class be derived from Command -- want
@@ -917,7 +917,7 @@
                     raise DistutilsOptionError, \
                           ("error in %s: command '%s' has no such option '%s'"
                            % (source, command_name, option))
-            except ValueError, msg:
+            except ValueError as msg:
                 raise DistutilsOptionError, msg
 
     def reinitialize_command (self, command, reinit_subcommands=0):

Modified: python/branches/p3yk/Lib/distutils/emxccompiler.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/emxccompiler.py	(original)
+++ python/branches/p3yk/Lib/distutils/emxccompiler.py	Wed Jan 10 17:19:56 2007
@@ -79,13 +79,13 @@
             # gcc requires '.rc' compiled to binary ('.res') files !!!
             try:
                 self.spawn(["rc", "-r", src])
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
         else: # for other files use the C-compiler
             try:
                 self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
                            extra_postargs)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
 
     def link (self,
@@ -275,7 +275,7 @@
         s = f.read()
         f.close()
 
-    except IOError, exc:
+    except IOError as exc:
         # if we can't read this file, we cannot say it is wrong
         # the compiler will complain later about this file as missing
         return (CONFIG_H_UNCERTAIN,

Modified: python/branches/p3yk/Lib/distutils/fancy_getopt.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/fancy_getopt.py	(original)
+++ python/branches/p3yk/Lib/distutils/fancy_getopt.py	Wed Jan 10 17:19:56 2007
@@ -256,7 +256,7 @@
         short_opts = string.join(self.short_opts)
         try:
             opts, args = getopt.getopt(args, short_opts, self.long_opts)
-        except getopt.error, msg:
+        except getopt.error as msg:
             raise DistutilsArgError, msg
 
         for opt, val in opts:

Modified: python/branches/p3yk/Lib/distutils/file_util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/file_util.py	(original)
+++ python/branches/p3yk/Lib/distutils/file_util.py	Wed Jan 10 17:19:56 2007
@@ -32,27 +32,31 @@
     try:
         try:
             fsrc = open(src, 'rb')
-        except os.error, (errno, errstr):
+        except os.error as e:
+            (errno, errstr) = e
             raise DistutilsFileError, \
                   "could not open '%s': %s" % (src, errstr)
 
         if os.path.exists(dst):
             try:
                 os.unlink(dst)
-            except os.error, (errno, errstr):
+            except os.error as e:
+                (errno, errstr) = e
                 raise DistutilsFileError, \
                       "could not delete '%s': %s" % (dst, errstr)
 
         try:
             fdst = open(dst, 'wb')
-        except os.error, (errno, errstr):
+        except os.error as e:
+            (errno, errstr) = e
             raise DistutilsFileError, \
                   "could not create '%s': %s" % (dst, errstr)
 
         while 1:
             try:
                 buf = fsrc.read(buffer_size)
-            except os.error, (errno, errstr):
+            except os.error as e:
+                (errno, errstr) = e
                 raise DistutilsFileError, \
                       "could not read from '%s': %s" % (src, errstr)
 
@@ -61,7 +65,8 @@
 
             try:
                 fdst.write(buf)
-            except os.error, (errno, errstr):
+            except os.error as e:
+                (errno, errstr) = e
                 raise DistutilsFileError, \
                       "could not write to '%s': %s" % (dst, errstr)
 
@@ -146,7 +151,7 @@
         import macostools
         try:
             macostools.copy(src, dst, 0, preserve_times)
-        except os.error, exc:
+        except os.error as exc:
             raise DistutilsFileError, \
                   "could not copy '%s' to '%s': %s" % (src, dst, exc[-1])
 
@@ -217,7 +222,8 @@
     copy_it = 0
     try:
         os.rename(src, dst)
-    except os.error, (num, msg):
+    except os.error as e:
+        (num, msg) = e
         if num == errno.EXDEV:
             copy_it = 1
         else:
@@ -228,7 +234,8 @@
         copy_file(src, dst)
         try:
             os.unlink(src)
-        except os.error, (num, msg):
+        except os.error as e:
+            (num, msg) = e
             try:
                 os.unlink(dst)
             except os.error:

Modified: python/branches/p3yk/Lib/distutils/msvccompiler.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/msvccompiler.py	(original)
+++ python/branches/p3yk/Lib/distutils/msvccompiler.py	Wed Jan 10 17:19:56 2007
@@ -129,7 +129,7 @@
                 self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
             else:
                 self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
-        except KeyError, exc: #
+        except KeyError as exc: #
             raise DistutilsPlatformError, \
                   ("""Python was built with Visual Studio 2003;
 extensions must be built with a compiler than can generate compatible binaries.
@@ -371,7 +371,7 @@
                 try:
                     self.spawn ([self.rc] + pp_opts +
                                 [output_opt] + [input_opt])
-                except DistutilsExecError, msg:
+                except DistutilsExecError as msg:
                     raise CompileError, msg
                 continue
             elif ext in self._mc_extensions:
@@ -400,7 +400,7 @@
                     self.spawn ([self.rc] +
                                 ["/fo" + obj] + [rc_file])
 
-                except DistutilsExecError, msg:
+                except DistutilsExecError as msg:
                     raise CompileError, msg
                 continue
             else:
@@ -414,7 +414,7 @@
                 self.spawn ([self.cc] + compile_opts + pp_opts +
                             [input_opt, output_opt] +
                             extra_postargs)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
 
         return objects
@@ -440,7 +440,7 @@
                 pass                    # XXX what goes here?
             try:
                 self.spawn ([self.lib] + lib_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise LibError, msg
 
         else:
@@ -519,7 +519,7 @@
             self.mkpath (os.path.dirname (output_filename))
             try:
                 self.spawn ([self.linker] + ld_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise LinkError, msg
 
         else:

Modified: python/branches/p3yk/Lib/distutils/spawn.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/spawn.py	(original)
+++ python/branches/p3yk/Lib/distutils/spawn.py	Wed Jan 10 17:19:56 2007
@@ -78,7 +78,7 @@
         # spawn for NT requires a full path to the .exe
         try:
             rc = os.spawnv(os.P_WAIT, executable, cmd)
-        except OSError, exc:
+        except OSError as exc:
             # this seems to happen when the command isn't found
             raise DistutilsExecError, \
                   "command '%s' failed: %s" % (cmd[0], exc[-1])
@@ -103,7 +103,7 @@
         # spawnv for OS/2 EMX requires a full path to the .exe
         try:
             rc = os.spawnv(os.P_WAIT, executable, cmd)
-        except OSError, exc:
+        except OSError as exc:
             # this seems to happen when the command isn't found
             raise DistutilsExecError, \
                   "command '%s' failed: %s" % (cmd[0], exc[-1])
@@ -131,7 +131,7 @@
             #print "cmd[0] =", cmd[0]
             #print "cmd =", cmd
             exec_fn(cmd[0], cmd)
-        except OSError, e:
+        except OSError as e:
             sys.stderr.write("unable to execute %s: %s\n" %
                              (cmd[0], e.strerror))
             os._exit(1)
@@ -146,7 +146,7 @@
         while 1:
             try:
                 (pid, status) = os.waitpid(pid, 0)
-            except OSError, exc:
+            except OSError as exc:
                 import errno
                 if exc.errno == errno.EINTR:
                     continue

Modified: python/branches/p3yk/Lib/distutils/sysconfig.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/sysconfig.py	(original)
+++ python/branches/p3yk/Lib/distutils/sysconfig.py	Wed Jan 10 17:19:56 2007
@@ -344,7 +344,7 @@
     try:
         filename = get_makefile_filename()
         parse_makefile(filename, g)
-    except IOError, msg:
+    except IOError as msg:
         my_msg = "invalid Python installation: unable to open %s" % filename
         if hasattr(msg, "strerror"):
             my_msg = my_msg + " (%s)" % msg.strerror
@@ -355,7 +355,7 @@
     try:
         filename = get_config_h_filename()
         parse_config_h(open(filename), g)
-    except IOError, msg:
+    except IOError as msg:
         my_msg = "invalid Python installation: unable to open %s" % filename
         if hasattr(msg, "strerror"):
             my_msg = my_msg + " (%s)" % msg.strerror

Modified: python/branches/p3yk/Lib/distutils/unixccompiler.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/unixccompiler.py	(original)
+++ python/branches/p3yk/Lib/distutils/unixccompiler.py	Wed Jan 10 17:19:56 2007
@@ -162,7 +162,7 @@
                 self.mkpath(os.path.dirname(output_file))
             try:
                 self.spawn(pp_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise CompileError, msg
 
     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
@@ -172,7 +172,7 @@
         try:
             self.spawn(compiler_so + cc_args + [src, '-o', obj] +
                        extra_postargs)
-        except DistutilsExecError, msg:
+        except DistutilsExecError as msg:
             raise CompileError, msg
 
     def create_static_lib(self, objects, output_libname,
@@ -196,7 +196,7 @@
             if self.ranlib:
                 try:
                     self.spawn(self.ranlib + [output_filename])
-                except DistutilsExecError, msg:
+                except DistutilsExecError as msg:
                     raise LibError, msg
         else:
             log.debug("skipping %s (up-to-date)", output_filename)
@@ -250,7 +250,7 @@
                     linker = _darwin_compiler_fixup(linker, ld_args)
 
                 self.spawn(linker + ld_args)
-            except DistutilsExecError, msg:
+            except DistutilsExecError as msg:
                 raise LinkError, msg
         else:
             log.debug("skipping %s (up-to-date)", output_filename)

Modified: python/branches/p3yk/Lib/distutils/util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/util.py	(original)
+++ python/branches/p3yk/Lib/distutils/util.py	Wed Jan 10 17:19:56 2007
@@ -229,7 +229,7 @@
 
     try:
         return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
-    except KeyError, var:
+    except KeyError as var:
         raise ValueError, "invalid variable '$%s'" % var
 
 # subst_vars ()

Modified: python/branches/p3yk/Lib/doctest.py
==============================================================================
--- python/branches/p3yk/Lib/doctest.py	(original)
+++ python/branches/p3yk/Lib/doctest.py	Wed Jan 10 17:19:56 2007
@@ -1604,8 +1604,8 @@
          ...                                    {}, 'foo', 'foo.py', 0)
          >>> try:
          ...     runner.run(test)
-         ... except UnexpectedException, failure:
-         ...     pass
+         ... except UnexpectedException as f:
+         ...     failure = f
 
          >>> failure.test is test
          True
@@ -1632,8 +1632,8 @@
 
          >>> try:
          ...    runner.run(test)
-         ... except DocTestFailure, failure:
-         ...    pass
+         ... except DocTestFailure as f:
+         ...    failure = f
 
        DocTestFailure objects provide access to the test:
 
@@ -2141,8 +2141,8 @@
              >>> case = DocTestCase(test)
              >>> try:
              ...     case.debug()
-             ... except UnexpectedException, failure:
-             ...     pass
+             ... except UnexpectedException as f:
+             ...     failure = f
 
            The UnexpectedException contains the test, the example, and
            the original exception:
@@ -2170,8 +2170,8 @@
 
              >>> try:
              ...    case.debug()
-             ... except DocTestFailure, failure:
-             ...    pass
+             ... except DocTestFailure as f:
+             ...    failure = f
 
            DocTestFailure objects provide access to the test:
 

Modified: python/branches/p3yk/Lib/encodings/uu_codec.py
==============================================================================
--- python/branches/p3yk/Lib/encodings/uu_codec.py	(original)
+++ python/branches/p3yk/Lib/encodings/uu_codec.py	Wed Jan 10 17:19:56 2007
@@ -81,7 +81,7 @@
             break
         try:
             data = a2b_uu(s)
-        except binascii.Error, v:
+        except binascii.Error as v:
             # Workaround for broken uuencoders by /Fredrik Lundh
             nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3
             data = a2b_uu(s[:nbytes])

Modified: python/branches/p3yk/Lib/filecmp.py
==============================================================================
--- python/branches/p3yk/Lib/filecmp.py	(original)
+++ python/branches/p3yk/Lib/filecmp.py	Wed Jan 10 17:19:56 2007
@@ -148,12 +148,12 @@
             ok = 1
             try:
                 a_stat = os.stat(a_path)
-            except os.error, why:
+            except os.error as why:
                 # print 'Can\'t stat', a_path, ':', why[1]
                 ok = 0
             try:
                 b_stat = os.stat(b_path)
-            except os.error, why:
+            except os.error as why:
                 # print 'Can\'t stat', b_path, ':', why[1]
                 ok = 0
 

Modified: python/branches/p3yk/Lib/ftplib.py
==============================================================================
--- python/branches/p3yk/Lib/ftplib.py	(original)
+++ python/branches/p3yk/Lib/ftplib.py	Wed Jan 10 17:19:56 2007
@@ -119,7 +119,7 @@
             try:
                 self.sock = socket.socket(af, socktype, proto)
                 self.sock.connect(sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if self.sock:
                     self.sock.close()
                 self.sock = None
@@ -277,7 +277,7 @@
             try:
                 sock = socket.socket(af, socktype, proto)
                 sock.bind(sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if sock:
                     sock.close()
                 sock = None
@@ -496,7 +496,7 @@
         if dirname == '..':
             try:
                 return self.voidcmd('CDUP')
-            except error_perm, msg:
+            except error_perm as msg:
                 if msg.args[0][:3] != '500':
                     raise
         elif dirname == '':

Modified: python/branches/p3yk/Lib/hotshot/stones.py
==============================================================================
--- python/branches/p3yk/Lib/hotshot/stones.py	(original)
+++ python/branches/p3yk/Lib/hotshot/stones.py	Wed Jan 10 17:19:56 2007
@@ -19,7 +19,7 @@
     stats.sort_stats('time', 'calls')
     try:
         stats.print_stats(20)
-    except IOError, e:
+    except IOError as e:
         if e.errno != errno.EPIPE:
             raise
 

Modified: python/branches/p3yk/Lib/htmllib.py
==============================================================================
--- python/branches/p3yk/Lib/htmllib.py	(original)
+++ python/branches/p3yk/Lib/htmllib.py	Wed Jan 10 17:19:56 2007
@@ -463,7 +463,7 @@
     else:
         try:
             f = open(file, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print file, ":", msg
             sys.exit(1)
 

Modified: python/branches/p3yk/Lib/httplib.py
==============================================================================
--- python/branches/p3yk/Lib/httplib.py	(original)
+++ python/branches/p3yk/Lib/httplib.py	Wed Jan 10 17:19:56 2007
@@ -667,7 +667,7 @@
                 if self.debuglevel > 0:
                     print "connect: (%s, %s)" % (self.host, self.port)
                 self.sock.connect(sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if self.debuglevel > 0:
                     print 'connect fail:', (self.host, self.port)
                 if self.sock:
@@ -713,7 +713,7 @@
                     data=str.read(blocksize)
             else:
                 self.sock.sendall(str)
-        except socket.error, v:
+        except socket.error as v:
             if v[0] == 32:      # Broken pipe
                 self.close()
             raise
@@ -868,7 +868,7 @@
 
         try:
             self._send_request(method, url, body, headers)
-        except socket.error, v:
+        except socket.error as v:
             # trap 'Broken pipe' if we're allowed to automatically reconnect
             if v[0] != 32 or not self.auto_open:
                 raise
@@ -890,7 +890,7 @@
             thelen=None
             try:
                 thelen=str(len(body))
-            except TypeError, te:
+            except TypeError as te:
                 # If this is a file-like object, try to
                 # fstat its file descriptor
                 import os
@@ -1019,7 +1019,7 @@
         while True:
             try:
                 buf = self._ssl.read(self._bufsize)
-            except socket.sslerror, err:
+            except socket.sslerror as err:
                 if (err[0] == socket.SSL_ERROR_WANT_READ
                     or err[0] == socket.SSL_ERROR_WANT_WRITE):
                     continue
@@ -1027,7 +1027,7 @@
                     or err[0] == socket.SSL_ERROR_EOF):
                     break
                 raise
-            except socket.error, err:
+            except socket.error as err:
                 if err[0] == errno.EINTR:
                     continue
                 if err[0] == errno.EBADF:
@@ -1215,7 +1215,7 @@
         """
         try:
             response = self._conn.getresponse()
-        except BadStatusLine, e:
+        except BadStatusLine as e:
             ### hmm. if getresponse() ever closes the socket on a bad request,
             ### then we are going to have problems with self.sock
 

Modified: python/branches/p3yk/Lib/idlelib/ClassBrowser.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/ClassBrowser.py	(original)
+++ python/branches/p3yk/Lib/idlelib/ClassBrowser.py	Wed Jan 10 17:19:56 2007
@@ -94,7 +94,7 @@
             return []
         try:
             dict = pyclbr.readmodule_ex(name, [dir] + sys.path)
-        except ImportError, msg:
+        except ImportError as msg:
             return []
         items = []
         self.classes = {}

Modified: python/branches/p3yk/Lib/idlelib/EditorWindow.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/EditorWindow.py	(original)
+++ python/branches/p3yk/Lib/idlelib/EditorWindow.py	Wed Jan 10 17:19:56 2007
@@ -505,7 +505,7 @@
         # XXX Ought to insert current file's directory in front of path
         try:
             (f, file, (suffix, mode, type)) = _find_module(name)
-        except (NameError, ImportError), msg:
+        except (NameError, ImportError) as msg:
             tkMessageBox.showerror("Import error", str(msg), parent=self.text)
             return
         if type != imp.PY_SOURCE:

Modified: python/branches/p3yk/Lib/idlelib/GrepDialog.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/GrepDialog.py	(original)
+++ python/branches/p3yk/Lib/idlelib/GrepDialog.py	Wed Jan 10 17:19:56 2007
@@ -82,7 +82,7 @@
         for fn in list:
             try:
                 f = open(fn)
-            except IOError, msg:
+            except IOError as msg:
                 print msg
                 continue
             lineno = 0
@@ -110,7 +110,7 @@
     def findfiles(self, dir, base, rec):
         try:
             names = os.listdir(dir or os.curdir)
-        except os.error, msg:
+        except os.error as msg:
             print msg
             return []
         list = []

Modified: python/branches/p3yk/Lib/idlelib/IOBinding.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/IOBinding.py	(original)
+++ python/branches/p3yk/Lib/idlelib/IOBinding.py	Wed Jan 10 17:19:56 2007
@@ -246,7 +246,7 @@
             f = open(filename,'rb')
             chars = f.read()
             f.close()
-        except IOError, msg:
+        except IOError as msg:
             tkMessageBox.showerror("I/O Error", str(msg), master=self.text)
             return False
 
@@ -289,7 +289,7 @@
         # Next look for coding specification
         try:
             enc = coding_spec(chars)
-        except LookupError, name:
+        except LookupError as name:
             tkMessageBox.showerror(
                 title="Error loading the file",
                 message="The encoding '%s' is not known to this Python "\
@@ -380,7 +380,7 @@
             f.flush()
             f.close()
             return True
-        except IOError, msg:
+        except IOError as msg:
             tkMessageBox.showerror("I/O Error", str(msg),
                                    master=self.text)
             return False
@@ -400,7 +400,7 @@
         try:
             enc = coding_spec(chars)
             failed = None
-        except LookupError, msg:
+        except LookupError as msg:
             failed = msg
             enc = None
         if enc:

Modified: python/branches/p3yk/Lib/idlelib/PyShell.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/PyShell.py	(original)
+++ python/branches/p3yk/Lib/idlelib/PyShell.py	Wed Jan 10 17:19:56 2007
@@ -380,7 +380,7 @@
             try:
                 self.rpcclt = MyRPCClient(addr)
                 break
-            except socket.error, err:
+            except socket.error as err:
                 pass
         else:
             self.display_port_binding_error()
@@ -389,7 +389,7 @@
         self.rpcclt.listening_sock.settimeout(10)
         try:
             self.rpcclt.accept()
-        except socket.timeout, err:
+        except socket.timeout as err:
             self.display_no_subprocess_error()
             return None
         self.rpcclt.register("stdin", self.tkconsole)
@@ -423,7 +423,7 @@
         self.spawn_subprocess()
         try:
             self.rpcclt.accept()
-        except socket.timeout, err:
+        except socket.timeout as err:
             self.display_no_subprocess_error()
             return None
         self.transfer_path()
@@ -1324,7 +1324,7 @@
     startup = False
     try:
         opts, args = getopt.getopt(sys.argv[1:], "c:deihnr:st:")
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stderr.write("Error: %s\n" % str(msg))
         sys.stderr.write(usage_msg)
         sys.exit(2)

Modified: python/branches/p3yk/Lib/idlelib/ScriptBinding.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/ScriptBinding.py	(original)
+++ python/branches/p3yk/Lib/idlelib/ScriptBinding.py	Wed Jan 10 17:19:56 2007
@@ -66,13 +66,13 @@
         f = open(filename, 'r')
         try:
             tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
-        except tokenize.TokenError, msg:
+        except tokenize.TokenError as msg:
             msgtxt, (lineno, start) = msg
             self.editwin.gotoline(lineno)
             self.errorbox("Tabnanny Tokenizing Error",
                           "Token Error: %s" % msgtxt)
             return False
-        except tabnanny.NannyNag, nag:
+        except tabnanny.NannyNag as nag:
             # The error messages from tabnanny are too confusing...
             self.editwin.gotoline(nag.get_lineno())
             self.errorbox("Tab/space error", indent_message)
@@ -97,7 +97,7 @@
             try:
                 # If successful, return the compiled code
                 return compile(source, filename, "exec")
-            except (SyntaxError, OverflowError), err:
+            except (SyntaxError, OverflowError) as err:
                 try:
                     msg, (errorfilename, lineno, offset, line) = err
                     if not errorfilename:

Modified: python/branches/p3yk/Lib/idlelib/SearchEngine.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/SearchEngine.py	(original)
+++ python/branches/p3yk/Lib/idlelib/SearchEngine.py	Wed Jan 10 17:19:56 2007
@@ -66,7 +66,7 @@
             flags = flags | re.IGNORECASE
         try:
             prog = re.compile(pat, flags)
-        except re.error, what:
+        except re.error as what:
             try:
                 msg, col = what
             except:

Modified: python/branches/p3yk/Lib/idlelib/run.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/run.py	(original)
+++ python/branches/p3yk/Lib/idlelib/run.py	Wed Jan 10 17:19:56 2007
@@ -114,7 +114,7 @@
         try:
             server = MyRPCServer(address, MyHandler)
             break
-        except socket.error, err:
+        except socket.error as err:
             print>>sys.__stderr__,"IDLE Subprocess: socket error: "\
                                         + err[1] + ", retrying...."
     else:

Modified: python/branches/p3yk/Lib/imaplib.py
==============================================================================
--- python/branches/p3yk/Lib/imaplib.py	(original)
+++ python/branches/p3yk/Lib/imaplib.py	Wed Jan 10 17:19:56 2007
@@ -845,7 +845,7 @@
 
         try:
             self.send('%s%s' % (data, CRLF))
-        except (socket.error, OSError), val:
+        except (socket.error, OSError) as val:
             raise self.abort('socket error: %s' % val)
 
         if literal is None:
@@ -870,7 +870,7 @@
             try:
                 self.send(literal)
                 self.send(CRLF)
-            except (socket.error, OSError), val:
+            except (socket.error, OSError) as val:
                 raise self.abort('socket error: %s' % val)
 
             if not literator:
@@ -883,9 +883,9 @@
         self._check_bye()
         try:
             typ, data = self._get_tagged_response(tag)
-        except self.abort, val:
+        except self.abort as val:
             raise self.abort('command: %s => %s' % (name, val))
-        except self.error, val:
+        except self.error as val:
             raise self.error('command: %s => %s' % (name, val))
         self._check_bye()
         if typ == 'BAD':
@@ -984,7 +984,7 @@
 
             try:
                 self._get_response()
-            except self.abort, val:
+            except self.abort as val:
                 if __debug__:
                     if self.debug >= 1:
                         self.print_log()
@@ -1402,7 +1402,7 @@
 
     try:
         optlist, args = getopt.getopt(sys.argv[1:], 'd:s:')
-    except getopt.error, val:
+    except getopt.error as val:
         optlist, args = (), ()
 
     stream_command = None

Modified: python/branches/p3yk/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/branches/p3yk/Lib/lib-tk/Tkinter.py	(original)
+++ python/branches/p3yk/Lib/lib-tk/Tkinter.py	Wed Jan 10 17:19:56 2007
@@ -85,7 +85,7 @@
         for c in _flatten(cnfs):
             try:
                 cnf.update(c)
-            except (AttributeError, TypeError), msg:
+            except (AttributeError, TypeError) as msg:
                 print "_cnfmerge: fallback due to:", msg
                 for k, v in c.items():
                     cnf[k] = v
@@ -1401,7 +1401,7 @@
             if self.subst:
                 args = self.subst(*args)
             return self.func(*args)
-        except SystemExit, msg:
+        except SystemExit as msg:
             raise SystemExit, msg
         except:
             self.widget._report_exception()

Modified: python/branches/p3yk/Lib/linecache.py
==============================================================================
--- python/branches/p3yk/Lib/linecache.py	(original)
+++ python/branches/p3yk/Lib/linecache.py	Wed Jan 10 17:19:56 2007
@@ -78,7 +78,7 @@
     fullname = filename
     try:
         stat = os.stat(fullname)
-    except os.error, msg:
+    except os.error as msg:
         basename = os.path.split(filename)[1]
 
         # Try for a __loader__, if available
@@ -128,7 +128,7 @@
         fp = open(fullname, 'rU')
         lines = fp.readlines()
         fp.close()
-    except IOError, msg:
+    except IOError as msg:
 ##      print '*** Cannot open', fullname, ':', msg
         return []
     size, mtime = stat.st_size, stat.st_mtime

Modified: python/branches/p3yk/Lib/logging/config.py
==============================================================================
--- python/branches/p3yk/Lib/logging/config.py	(original)
+++ python/branches/p3yk/Lib/logging/config.py	Wed Jan 10 17:19:56 2007
@@ -288,7 +288,7 @@
                     except:
                         traceback.print_exc()
                     os.remove(file)
-            except socket.error, e:
+            except socket.error as e:
                 if type(e.args) != types.TupleType:
                     raise
                 else:

Modified: python/branches/p3yk/Lib/mailbox.py
==============================================================================
--- python/branches/p3yk/Lib/mailbox.py	(original)
+++ python/branches/p3yk/Lib/mailbox.py	Wed Jan 10 17:19:56 2007
@@ -258,7 +258,7 @@
                 os.remove(tmp_file.name)
             else:
                 os.rename(tmp_file.name, dest)
-        except OSError, e:
+        except OSError as e:
             os.remove(tmp_file.name)
             if e.errno == errno.EEXIST:
                 raise ExternalClashError('Name clash with existing message: %s'
@@ -280,7 +280,7 @@
             self.remove(key)
         except KeyError:
             pass
-        except OSError, e:
+        except OSError as e:
             if e.errno != errno.ENOENT:
                 raise
 
@@ -437,12 +437,12 @@
         path = os.path.join(self._path, 'tmp', uniq)
         try:
             os.stat(path)
-        except OSError, e:
+        except OSError as e:
             if e.errno == errno.ENOENT:
                 Maildir._count += 1
                 try:
                     return _create_carefully(path)
-                except OSError, e:
+                except OSError as e:
                     if e.errno != errno.EEXIST:
                         raise
             else:
@@ -495,7 +495,7 @@
         Mailbox.__init__(self, path, factory, create)
         try:
             f = open(self._path, 'rb+')
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 if create:
                     f = open(self._path, 'wb+')
@@ -605,7 +605,7 @@
         self._file.close()
         try:
             os.rename(new_file.name, self._path)
-        except OSError, e:
+        except OSError as e:
             if e.errno == errno.EEXIST or \
               (os.name == 'os2' and e.errno == errno.EACCES):
                 os.remove(self._path)
@@ -837,7 +837,7 @@
         path = os.path.join(self._path, str(key))
         try:
             f = open(path, 'rb+')
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)
             else:
@@ -859,7 +859,7 @@
         path = os.path.join(self._path, str(key))
         try:
             f = open(path, 'rb+')
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)
             else:
@@ -885,7 +885,7 @@
                 f = open(os.path.join(self._path, str(key)), 'r+')
             else:
                 f = open(os.path.join(self._path, str(key)), 'r')
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)
             else:
@@ -912,7 +912,7 @@
                 f = open(os.path.join(self._path, str(key)), 'r+')
             else:
                 f = open(os.path.join(self._path, str(key)), 'r')
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)
             else:
@@ -932,7 +932,7 @@
         """Return a file-like representation or raise a KeyError."""
         try:
             f = open(os.path.join(self._path, str(key)), 'rb')
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)
             else:
@@ -1843,7 +1843,7 @@
         if fcntl:
             try:
                 fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
-            except IOError, e:
+            except IOError as e:
                 if e.errno in (errno.EAGAIN, errno.EACCES):
                     raise ExternalClashError('lockf: lock unavailable: %s' %
                                              f.name)
@@ -1853,7 +1853,7 @@
             try:
                 pre_lock = _create_temporary(f.name + '.lock')
                 pre_lock.close()
-            except IOError, e:
+            except IOError as e:
                 if e.errno == errno.EACCES:
                     return  # Without write access, just skip dotlocking.
                 else:
@@ -1866,7 +1866,7 @@
                 else:
                     os.rename(pre_lock.name, f.name + '.lock')
                     dotlock_done = True
-            except OSError, e:
+            except OSError as e:
                 if e.errno == errno.EEXIST or \
                   (os.name == 'os2' and e.errno == errno.EACCES):
                     os.remove(pre_lock.name)

Modified: python/branches/p3yk/Lib/mhlib.py
==============================================================================
--- python/branches/p3yk/Lib/mhlib.py	(original)
+++ python/branches/p3yk/Lib/mhlib.py	Wed Jan 10 17:19:56 2007
@@ -370,7 +370,7 @@
                 count = len(all)
             try:
                 anchor = self._parseindex(head, all)
-            except Error, msg:
+            except Error as msg:
                 seqs = self.getsequences()
                 if not head in seqs:
                     if not msg:
@@ -407,7 +407,7 @@
         # Neither X:Y nor X-Y; must be a number or a (pseudo-)sequence
         try:
             n = self._parseindex(seq, all)
-        except Error, msg:
+        except Error as msg:
             seqs = self.getsequences()
             if not seq in seqs:
                 if not msg:
@@ -471,7 +471,7 @@
                 pass
             try:
                 os.rename(path, commapath)
-            except os.error, msg:
+            except os.error as msg:
                 errors.append(msg)
             else:
                 deleted.append(n)
@@ -499,7 +499,7 @@
                 try:
                     shutil.copy2(path, topath)
                     os.unlink(path)
-                except (IOError, os.error), msg:
+                except (IOError, os.error) as msg:
                     errors.append(msg)
                     try:
                         os.unlink(topath)
@@ -989,7 +989,7 @@
                 'all'):
         try:
             do('f.parsesequence(%r)' % (seq,))
-        except Error, msg:
+        except Error as msg:
             print "Error:", msg
         stuff = os.popen("pick %r 2>/dev/null" % (seq,)).read()
         list = map(int, stuff.split())

Modified: python/branches/p3yk/Lib/mimetypes.py
==============================================================================
--- python/branches/p3yk/Lib/mimetypes.py	(original)
+++ python/branches/p3yk/Lib/mimetypes.py	Wed Jan 10 17:19:56 2007
@@ -510,7 +510,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'hle',
                                    ['help', 'lenient', 'extension'])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(1, msg)
 
     strict = 1

Modified: python/branches/p3yk/Lib/modulefinder.py
==============================================================================
--- python/branches/p3yk/Lib/modulefinder.py	(original)
+++ python/branches/p3yk/Lib/modulefinder.py	Wed Jan 10 17:19:56 2007
@@ -317,7 +317,7 @@
             return
         try:
             self.import_hook(name, caller, level=level)
-        except ImportError, msg:
+        except ImportError as msg:
             self.msg(2, "ImportError:", str(msg))
             self._add_badmodule(name, caller)
         else:
@@ -328,7 +328,7 @@
                         continue
                     try:
                         self.import_hook(name, caller, [sub], level=level)
-                    except ImportError, msg:
+                    except ImportError as msg:
                         self.msg(2, "ImportError:", str(msg))
                         fullname = name + "." + sub
                         self._add_badmodule(fullname, caller)
@@ -602,7 +602,7 @@
     import getopt
     try:
         opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:")
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         return
 

Modified: python/branches/p3yk/Lib/msilib/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/msilib/__init__.py	(original)
+++ python/branches/p3yk/Lib/msilib/__init__.py	Wed Jan 10 17:19:56 2007
@@ -111,7 +111,7 @@
                 raise TypeError, "Unsupported type %s" % field.__class__.__name__
         try:
             v.Modify(MSIMODIFY_INSERT, r)
-        except Exception, e:
+        except Exception as e:
             raise MSIError("Could not insert "+repr(values)+" into "+table)
 
         r.ClearData()

Modified: python/branches/p3yk/Lib/nntplib.py
==============================================================================
--- python/branches/p3yk/Lib/nntplib.py	(original)
+++ python/branches/p3yk/Lib/nntplib.py	Wed Jan 10 17:19:56 2007
@@ -127,7 +127,7 @@
             except NNTPPermanentError:
                 # error 500, probably 'not implemented'
                 pass
-            except NNTPTemporaryError, e:
+            except NNTPTemporaryError as e:
                 if user and e.response[:3] == '480':
                     # Need authorization before 'mode reader'
                     readermode_afterauth = 1

Modified: python/branches/p3yk/Lib/optparse.py
==============================================================================
--- python/branches/p3yk/Lib/optparse.py	(original)
+++ python/branches/p3yk/Lib/optparse.py	Wed Jan 10 17:19:56 2007
@@ -1376,7 +1376,7 @@
 
         try:
             stop = self._process_args(largs, rargs, values)
-        except (BadOptionError, OptionValueError), err:
+        except (BadOptionError, OptionValueError) as err:
             self.error(str(err))
 
         args = largs + rargs

Modified: python/branches/p3yk/Lib/os.py
==============================================================================
--- python/branches/p3yk/Lib/os.py	(original)
+++ python/branches/p3yk/Lib/os.py	Wed Jan 10 17:19:56 2007
@@ -163,7 +163,7 @@
     if head and tail and not path.exists(head):
         try:
             makedirs(head, mode)
-        except OSError, e:
+        except OSError as e:
             # be happy if someone already created the path
             if e.errno != EEXIST:
                 raise
@@ -284,7 +284,7 @@
         # Note that listdir and error are globals in this module due
         # to earlier import-*.
         names = listdir(top)
-    except error, err:
+    except error as err:
         if onerror is not None:
             onerror(err)
         return
@@ -390,7 +390,7 @@
         fullname = path.join(dir, file)
         try:
             func(fullname, *argrest)
-        except error, e:
+        except error as e:
             tb = sys.exc_info()[2]
             if (e.errno != ENOENT and e.errno != ENOTDIR
                 and saved_exc is None):

Modified: python/branches/p3yk/Lib/pdb.py
==============================================================================
--- python/branches/p3yk/Lib/pdb.py	(original)
+++ python/branches/p3yk/Lib/pdb.py	Wed Jan 10 17:19:56 2007
@@ -330,7 +330,7 @@
             arg = arg[colon+1:].lstrip()
             try:
                 lineno = int(arg)
-            except ValueError, msg:
+            except ValueError as msg:
                 print >>self.stdout, '*** Bad lineno:', arg
                 return
         else:
@@ -618,7 +618,7 @@
                 self.curframe.f_lineno = arg
                 self.stack[self.curindex] = self.stack[self.curindex][0], arg
                 self.print_stack_entry(self.stack[self.curindex])
-            except ValueError, e:
+            except ValueError as e:
                 print >>self.stdout, '*** Jump failed:', e
     do_j = do_jump
 

Modified: python/branches/p3yk/Lib/pickle.py
==============================================================================
--- python/branches/p3yk/Lib/pickle.py	(original)
+++ python/branches/p3yk/Lib/pickle.py	Wed Jan 10 17:19:56 2007
@@ -816,7 +816,7 @@
             while 1:
                 key = read(1)
                 dispatch[key](self)
-        except _Stop, stopinst:
+        except _Stop as stopinst:
             return stopinst.value
 
     # Return largest index k such that self.stack[k] is self.mark.
@@ -1018,7 +1018,7 @@
         if not instantiated:
             try:
                 value = klass(*args)
-            except TypeError, err:
+            except TypeError as err:
                 raise TypeError, "in constructor for %s: %s" % (
                     klass.__name__, str(err)), sys.exc_info()[2]
         self.append(value)

Modified: python/branches/p3yk/Lib/pkgutil.py
==============================================================================
--- python/branches/p3yk/Lib/pkgutil.py	(original)
+++ python/branches/p3yk/Lib/pkgutil.py	Wed Jan 10 17:19:56 2007
@@ -532,7 +532,7 @@
         if os.path.isfile(pkgfile):
             try:
                 f = open(pkgfile)
-            except IOError, msg:
+            except IOError as msg:
                 sys.stderr.write("Can't open %s: %s\n" %
                                  (pkgfile, msg))
             else:

Modified: python/branches/p3yk/Lib/plat-irix5/torgb.py
==============================================================================
--- python/branches/p3yk/Lib/plat-irix5/torgb.py	(original)
+++ python/branches/p3yk/Lib/plat-irix5/torgb.py	Wed Jan 10 17:19:56 2007
@@ -80,7 +80,7 @@
         fname = filename
     try:
         ftype = imghdr.what(fname)
-    except IOError, msg:
+    except IOError as msg:
         if type(msg) == type(()) and len(msg) == 2 and \
                 type(msg[0]) == type(0) and type(msg[1]) == type(''):
             msg = msg[1]

Modified: python/branches/p3yk/Lib/plat-irix6/torgb.py
==============================================================================
--- python/branches/p3yk/Lib/plat-irix6/torgb.py	(original)
+++ python/branches/p3yk/Lib/plat-irix6/torgb.py	Wed Jan 10 17:19:56 2007
@@ -80,7 +80,7 @@
         fname = filename
     try:
         ftype = imghdr.what(fname)
-    except IOError, msg:
+    except IOError as msg:
         if type(msg) == type(()) and len(msg) == 2 and \
                 type(msg[0]) == type(0) and type(msg[1]) == type(''):
             msg = msg[1]

Modified: python/branches/p3yk/Lib/plat-mac/EasyDialogs.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/EasyDialogs.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/EasyDialogs.py	Wed Jan 10 17:19:56 2007
@@ -651,7 +651,7 @@
     try:
         rr = Nav.NavChooseFile(args)
         good = 1
-    except Nav.error, arg:
+    except Nav.error as arg:
         if arg[0] != -128: # userCancelledErr
             raise Nav.error, arg
         return None
@@ -704,7 +704,7 @@
     try:
         rr = Nav.NavPutFile(args)
         good = 1
-    except Nav.error, arg:
+    except Nav.error as arg:
         if arg[0] != -128: # userCancelledErr
             raise Nav.error, arg
         return None
@@ -764,7 +764,7 @@
     try:
         rr = Nav.NavChooseFolder(args)
         good = 1
-    except Nav.error, arg:
+    except Nav.error as arg:
         if arg[0] != -128: # userCancelledErr
             raise Nav.error, arg
         return None

Modified: python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py	Wed Jan 10 17:19:56 2007
@@ -70,7 +70,7 @@
             msg = "High Level Event: %r %r" % (code(message), code(h | (v<<16)))
             try:
                 AE.AEProcessAppleEvent(event)
-            except AE.Error, err:
+            except AE.Error as err:
                 print 'AE error: ', err
                 print 'in', msg
                 traceback.print_exc()

Modified: python/branches/p3yk/Lib/plat-mac/aetools.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/aetools.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/aetools.py	Wed Jan 10 17:19:56 2007
@@ -57,7 +57,7 @@
 def missed(ae):
     try:
         desc = ae.AEGetAttributeDesc('miss', 'keyw')
-    except AE.Error, msg:
+    except AE.Error as msg:
         return None
     return desc.data
 
@@ -86,7 +86,7 @@
     for key in aekeywords:
         try:
             desc = ae.AEGetAttributeDesc(key, '****')
-        except (AE.Error, MacOS.Error), msg:
+        except (AE.Error, MacOS.Error) as msg:
             if msg[0] != -1701 and msg[0] != -1704:
                 raise
             continue

Modified: python/branches/p3yk/Lib/plat-mac/applesingle.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/applesingle.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/applesingle.py	Wed Jan 10 17:19:56 2007
@@ -48,7 +48,7 @@
         header = fileobj.read(AS_HEADER_LENGTH)
         try:
             magic, version, ig, nentry = struct.unpack(AS_HEADER_FORMAT, header)
-        except ValueError, arg:
+        except ValueError as arg:
             raise Error, "Unpack header error: %s" % (arg,)
         if verbose:
             print 'Magic:   0x%8.8x' % (magic,)
@@ -65,7 +65,7 @@
         for hdr in headers:
             try:
                 restype, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr)
-            except ValueError, arg:
+            except ValueError as arg:
                 raise Error, "Unpack entry error: %s" % (arg,)
             if verbose:
                 print "Fork %d, offset %d, length %d" % (restype, offset, length)

Modified: python/branches/p3yk/Lib/plat-mac/argvemulator.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/argvemulator.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/argvemulator.py	Wed Jan 10 17:19:56 2007
@@ -52,7 +52,7 @@
         if what == kHighLevelEvent:
             try:
                 AE.AEProcessAppleEvent(event)
-            except AE.Error, err:
+            except AE.Error as err:
                 msg = "High Level Event: %r %r" % (hex(message), hex(h | (v<<16)))
                 print 'AE error: ', err
                 print 'in', msg
@@ -77,7 +77,7 @@
                 fsref = alias.FSResolveAlias(None)[0]
                 pathname = fsref.as_pathname()
                 sys.argv.append(pathname)
-        except  Exception, e:
+        except  Exception as e:
             print "argvemulator.py warning: can't unpack an open document event"
             import traceback
             traceback.print_exc()

Modified: python/branches/p3yk/Lib/plat-mac/buildtools.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/buildtools.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/buildtools.py	Wed Jan 10 17:19:56 2007
@@ -78,7 +78,7 @@
     fp.close()
     try:
         code = compile(text + '\n', filename, "exec")
-    except SyntaxError, arg:
+    except SyntaxError as arg:
         raise BuildError, "Syntax error in script %s: %s" % (filename, arg)
     except EOFError:
         raise BuildError, "End-of-file in script %s" % (filename,)

Modified: python/branches/p3yk/Lib/plat-mac/bundlebuilder.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/bundlebuilder.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/bundlebuilder.py	Wed Jan 10 17:19:56 2007
@@ -764,7 +764,7 @@
     directory. Don't moan if any path element already exists."""
     try:
         os.makedirs(dir)
-    except OSError, why:
+    except OSError as why:
         if why.errno != errno.EEXIST:
             raise
 

Modified: python/branches/p3yk/Lib/plat-mac/gensuitemodule.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/gensuitemodule.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/gensuitemodule.py	Wed Jan 10 17:19:56 2007
@@ -114,7 +114,7 @@
     try:
         processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname,
         verbose=sys.stderr)
-    except MacOS.Error, arg:
+    except MacOS.Error as arg:
         print "Error getting terminology:", arg
         print "Retry, manually parsing resources"
         processfile_fromresource(filename, edit_modnames=edit_modnames,
@@ -190,7 +190,7 @@
         print >>verbose, "\nASKING FOR aete DICTIONARY IN", repr(fullname)
     try:
         aedescobj, launched = OSATerminology.GetAppTerminology(fullname)
-    except MacOS.Error, arg:
+    except MacOS.Error as arg:
         if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound
             if verbose:
                 print >>verbose, "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually"
@@ -244,7 +244,7 @@
     talker = aetools.TalkTo(cr)
     try:
         talker._start()
-    except (MacOS.Error, aetools.Error), arg:
+    except (MacOS.Error, aetools.Error) as arg:
         if verbose:
             print >>verbose, 'Warning: start() failed, continuing anyway:', arg
     reply = talker.send("ascr", "gdte")

Modified: python/branches/p3yk/Lib/plat-mac/macresource.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/macresource.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/macresource.py	Wed Jan 10 17:19:56 2007
@@ -76,14 +76,14 @@
     AppleSingle file"""
     try:
         refno = Res.FSpOpenResFile(pathname, 1)
-    except Res.Error, arg:
+    except Res.Error as arg:
         if arg[0] in (-37, -39):
             # No resource fork. We may be on OSX, and this may be either
             # a data-fork based resource file or a AppleSingle file
             # from the CVS repository.
             try:
                 refno = Res.FSOpenResourceFile(pathname, u'', 1)
-            except Res.Error, arg:
+            except Res.Error as arg:
                 if arg[0] != -199:
                     # -199 is "bad resource map"
                     raise
@@ -103,14 +103,14 @@
     try:
         refno = Res.FSpOpenResFile(pathname, 1)
         Res.CloseResFile(refno)
-    except Res.Error, arg:
+    except Res.Error as arg:
         if arg[0] in (-37, -39):
             # No resource fork. We may be on OSX, and this may be either
             # a data-fork based resource file or a AppleSingle file
             # from the CVS repository.
             try:
                 refno = Res.FSOpenResourceFile(pathname, u'', 1)
-            except Res.Error, arg:
+            except Res.Error as arg:
                 if arg[0] != -199:
                     # -199 is "bad resource map"
                     raise

Modified: python/branches/p3yk/Lib/plat-mac/pimp.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/pimp.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/pimp.py	Wed Jan 10 17:19:56 2007
@@ -76,7 +76,7 @@
         url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine)
         try:
             urllib2.urlopen(url)
-        except urllib2.HTTPError, arg:
+        except urllib2.HTTPError as arg:
             pass
         else:
             break
@@ -589,13 +589,13 @@
         installTest = self._dict['Install-test'].strip() + '\n'
         try:
             exec(installTest, namespace)
-        except ImportError, arg:
+        except ImportError as arg:
             return "no", str(arg)
-        except _scriptExc_NotInstalled, arg:
+        except _scriptExc_NotInstalled as arg:
             return "no", str(arg)
-        except _scriptExc_OldInstalled, arg:
+        except _scriptExc_OldInstalled as arg:
             return "old", str(arg)
-        except _scriptExc_BadInstalled, arg:
+        except _scriptExc_BadInstalled as arg:
             return "bad", str(arg)
         except:
             sys.stderr.write("-------------------------------------\n")

Modified: python/branches/p3yk/Lib/plat-mac/terminalcommand.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/terminalcommand.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/terminalcommand.py	Wed Jan 10 17:19:56 2007
@@ -35,7 +35,7 @@
 
     try:
         theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
-    except AE.Error, why:
+    except AE.Error as why:
         if why[0] != -600:  # Terminal.app not yet running
             raise
         os.system(START_TERMINAL)

Modified: python/branches/p3yk/Lib/platform.py
==============================================================================
--- python/branches/p3yk/Lib/platform.py	(original)
+++ python/branches/p3yk/Lib/platform.py	Wed Jan 10 17:19:56 2007
@@ -404,10 +404,10 @@
                 raise os.error,'command failed'
             # XXX How can I supress shell errors from being written
             #     to stderr ?
-        except os.error,why:
+        except os.error as why:
             #print 'Command %s failed: %s' % (cmd,why)
             continue
-        except IOError,why:
+        except IOError as why:
             #print 'Command %s failed: %s' % (cmd,why)
             continue
         else:

Modified: python/branches/p3yk/Lib/poplib.py
==============================================================================
--- python/branches/p3yk/Lib/poplib.py	(original)
+++ python/branches/p3yk/Lib/poplib.py	Wed Jan 10 17:19:56 2007
@@ -86,7 +86,7 @@
             try:
                 self.sock = socket.socket(af, socktype, proto)
                 self.sock.connect(sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if self.sock:
                     self.sock.close()
                 self.sock = None
@@ -262,7 +262,7 @@
         """Signoff: commit changes on server, unlock mailbox, close connection."""
         try:
             resp = self._shortcmd('QUIT')
-        except error_proto, val:
+        except error_proto as val:
             resp = val
         self.file.close()
         self.sock.close()
@@ -347,7 +347,7 @@
             try:
                 self.sock = socket.socket(af, socktype, proto)
                 self.sock.connect(sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if self.sock:
                     self.sock.close()
                 self.sock = None
@@ -399,7 +399,7 @@
         """Signoff: commit changes on server, unlock mailbox, close connection."""
         try:
             resp = self._shortcmd('QUIT')
-        except error_proto, val:
+        except error_proto as val:
             resp = val
         self.sock.close()
         del self.sslobj, self.sock

Modified: python/branches/p3yk/Lib/pstats.py
==============================================================================
--- python/branches/p3yk/Lib/pstats.py	(original)
+++ python/branches/p3yk/Lib/pstats.py	Wed Jan 10 17:19:56 2007
@@ -618,7 +618,7 @@
             if line:
                 try:
                     self.stats = Stats(line)
-                except IOError, args:
+                except IOError as args:
                     print >> self.stream, args[1]
                     return
                 self.prompt = line + "% "

Modified: python/branches/p3yk/Lib/pty.py
==============================================================================
--- python/branches/p3yk/Lib/pty.py	(original)
+++ python/branches/p3yk/Lib/pty.py	Wed Jan 10 17:19:56 2007
@@ -56,7 +56,7 @@
     else:
         try:
             tty_name, master_fd = sgi._getpty(os.O_RDWR, 0666, 0)
-        except IOError, msg:
+        except IOError as msg:
             raise os.error, msg
         return master_fd, tty_name
     for x in 'pqrstuvwxyzPQRST':

Modified: python/branches/p3yk/Lib/py_compile.py
==============================================================================
--- python/branches/p3yk/Lib/py_compile.py	(original)
+++ python/branches/p3yk/Lib/py_compile.py	Wed Jan 10 17:19:56 2007
@@ -123,7 +123,7 @@
         codestring = codestring + '\n'
     try:
         codeobject = __builtin__.compile(codestring, dfile or file,'exec')
-    except Exception,err:
+    except Exception as err:
         py_exc = PyCompileError(err.__class__,err.args,dfile or file)
         if doraise:
             raise py_exc
@@ -157,7 +157,7 @@
     for filename in args:
         try:
             compile(filename, doraise=True)
-        except PyCompileError,err:
+        except PyCompileError as err:
             sys.stderr.write(err.msg)
 
 if __name__ == "__main__":

Modified: python/branches/p3yk/Lib/pydoc.py
==============================================================================
--- python/branches/p3yk/Lib/pydoc.py	(original)
+++ python/branches/p3yk/Lib/pydoc.py	Wed Jan 10 17:19:56 2007
@@ -1479,7 +1479,7 @@
             object = type(object)
             desc += ' object'
         pager(title % desc + '\n\n' + text.document(object, name))
-    except (ImportError, ErrorDuringImport), value:
+    except (ImportError, ErrorDuringImport) as value:
         print value
 
 def writedoc(thing, forceload=0):
@@ -1491,7 +1491,7 @@
         file.write(page)
         file.close()
         print 'wrote', name + '.html'
-    except (ImportError, ErrorDuringImport), value:
+    except (ImportError, ErrorDuringImport) as value:
         print value
 
 def writedocs(dir, pkgpath='', done=None):
@@ -1920,7 +1920,7 @@
             if path and path != '.':
                 try:
                     obj = locate(path, forceload=1)
-                except ErrorDuringImport, value:
+                except ErrorDuringImport as value:
                     self.send_document(path, html.escape(str(value)))
                     return
                 if obj:
@@ -2223,7 +2223,7 @@
                         writedoc(arg)
                 else:
                     help.help(arg)
-            except ErrorDuringImport, value:
+            except ErrorDuringImport as value:
                 print value
 
     except (getopt.error, BadUsage):

Modified: python/branches/p3yk/Lib/quopri.py
==============================================================================
--- python/branches/p3yk/Lib/quopri.py	(original)
+++ python/branches/p3yk/Lib/quopri.py	Wed Jan 10 17:19:56 2007
@@ -194,7 +194,7 @@
     import getopt
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'td')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stdout = sys.stderr
         print msg
         print "usage: quopri [-t | -d] [file] ..."
@@ -218,7 +218,7 @@
         else:
             try:
                 fp = open(file)
-            except IOError, msg:
+            except IOError as msg:
                 sys.stderr.write("%s: can't open (%s)\n" % (file, msg))
                 sts = 1
                 continue

Modified: python/branches/p3yk/Lib/re.py
==============================================================================
--- python/branches/p3yk/Lib/re.py	(original)
+++ python/branches/p3yk/Lib/re.py	Wed Jan 10 17:19:56 2007
@@ -229,7 +229,7 @@
         raise TypeError, "first argument must be string or compiled pattern"
     try:
         p = sre_compile.compile(pattern, flags)
-    except error, v:
+    except error as v:
         raise error, v # invalid expression
     if len(_cache) >= _MAXCACHE:
         _cache.clear()
@@ -244,7 +244,7 @@
     repl, pattern = key
     try:
         p = sre_parse.parse_template(repl, pattern)
-    except error, v:
+    except error as v:
         raise error, v # invalid expression
     if len(_cache_repl) >= _MAXCACHE:
         _cache_repl.clear()

Modified: python/branches/p3yk/Lib/rexec.py
==============================================================================
--- python/branches/p3yk/Lib/rexec.py	(original)
+++ python/branches/p3yk/Lib/rexec.py	Wed Jan 10 17:19:56 2007
@@ -551,7 +551,7 @@
     if args and args[0] != '-':
         try:
             fp = open(args[0])
-        except IOError, msg:
+        except IOError as msg:
             print "%s: can't open file %r" % (sys.argv[0], args[0])
             return 1
     if fp.isatty():
@@ -566,7 +566,7 @@
                 r.s_apply(code.InteractiveConsole.runcode, (self, co))
         try:
             RestrictedConsole(r.modules['__main__'].__dict__).interact()
-        except SystemExit, n:
+        except SystemExit as n:
             return n
     else:
         text = fp.read()
@@ -574,7 +574,7 @@
         c = compile(text, fp.name, 'exec')
         try:
             r.s_exec(c)
-        except SystemExit, n:
+        except SystemExit as n:
             return n
         except:
             traceback.print_exc()

Modified: python/branches/p3yk/Lib/sgmllib.py
==============================================================================
--- python/branches/p3yk/Lib/sgmllib.py	(original)
+++ python/branches/p3yk/Lib/sgmllib.py	Wed Jan 10 17:19:56 2007
@@ -530,7 +530,7 @@
     else:
         try:
             f = open(file, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print file, ":", msg
             sys.exit(1)
 

Modified: python/branches/p3yk/Lib/shutil.py
==============================================================================
--- python/branches/p3yk/Lib/shutil.py	(original)
+++ python/branches/p3yk/Lib/shutil.py	Wed Jan 10 17:19:56 2007
@@ -121,18 +121,18 @@
             else:
                 copy2(srcname, dstname)
             # XXX What about devices, sockets etc.?
-        except (IOError, os.error), why:
+        except (IOError, os.error) as why:
             errors.append((srcname, dstname, str(why)))
         # catch the Error from the recursive copytree so that we can
         # continue with other files
-        except Error, err:
+        except Error as err:
             errors.extend(err.args[0])
     try:
         copystat(src, dst)
     except WindowsError:
         # can't copy file access times on Windows
         pass
-    except OSError, why:
+    except OSError as why:
         errors.extend((src, dst, str(why)))
     if errors:
         raise Error, errors
@@ -157,7 +157,7 @@
     names = []
     try:
         names = os.listdir(path)
-    except os.error, err:
+    except os.error as err:
         onerror(os.listdir, path, sys.exc_info())
     for name in names:
         fullname = os.path.join(path, name)
@@ -170,7 +170,7 @@
         else:
             try:
                 os.remove(fullname)
-            except os.error, err:
+            except os.error as err:
                 onerror(os.remove, fullname, sys.exc_info())
     try:
         os.rmdir(path)

Modified: python/branches/p3yk/Lib/site.py
==============================================================================
--- python/branches/p3yk/Lib/site.py	(original)
+++ python/branches/p3yk/Lib/site.py	Wed Jan 10 17:19:56 2007
@@ -391,7 +391,7 @@
         import sitecustomize
     except ImportError:
         pass
-    except Exception, err:
+    except Exception as err:
         if os.environ.get("PYTHONVERBOSE"):
             raise
         sys.stderr.write(

Modified: python/branches/p3yk/Lib/smtpd.py
==============================================================================
--- python/branches/p3yk/Lib/smtpd.py	(original)
+++ python/branches/p3yk/Lib/smtpd.py	Wed Jan 10 17:19:56 2007
@@ -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.'

Modified: python/branches/p3yk/Lib/smtplib.py
==============================================================================
--- python/branches/p3yk/Lib/smtplib.py	(original)
+++ python/branches/p3yk/Lib/smtplib.py	Wed Jan 10 17:19:56 2007
@@ -306,7 +306,7 @@
             af, socktype, proto, canonname, sa = res
             try:
                 self._get_socket(af,socktype,proto,sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if self.debuglevel > 0: print>>stderr, 'connect fail:', msg
                 if self.sock:
                     self.sock.close()

Modified: python/branches/p3yk/Lib/sqlite3/test/dbapi.py
==============================================================================
--- python/branches/p3yk/Lib/sqlite3/test/dbapi.py	(original)
+++ python/branches/p3yk/Lib/sqlite3/test/dbapi.py	Wed Jan 10 17:19:56 2007
@@ -326,7 +326,7 @@
             self.fail("should have raised a TypeError")
         except TypeError:
             return
-        except Exception, e:
+        except Exception as e:
             print "raised", e.__class__
             self.fail("raised wrong exception.")
 

Modified: python/branches/p3yk/Lib/sqlite3/test/hooks.py
==============================================================================
--- python/branches/p3yk/Lib/sqlite3/test/hooks.py	(original)
+++ python/branches/p3yk/Lib/sqlite3/test/hooks.py	Wed Jan 10 17:19:56 2007
@@ -36,7 +36,7 @@
         try:
             con.create_collation("X", 42)
             self.fail("should have raised a TypeError")
-        except TypeError, e:
+        except TypeError as e:
             self.failUnlessEqual(e.args[0], "parameter must be callable")
 
     def CheckCreateCollationNotAscii(self):
@@ -44,7 +44,7 @@
         try:
             con.create_collation("collä", cmp)
             self.fail("should have raised a ProgrammingError")
-        except sqlite.ProgrammingError, e:
+        except sqlite.ProgrammingError as e:
             pass
 
     def CheckCollationIsUsed(self):
@@ -73,7 +73,7 @@
         try:
             result = con.execute(sql).fetchall()
             self.fail("should have raised an OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             self.failUnlessEqual(e.args[0].lower(), "no such collation sequence: mycoll")
 
     def CheckCollationRegisterTwice(self):
@@ -101,7 +101,7 @@
         try:
             con.execute("select 'a' as x union select 'b' as x order by x collate mycoll")
             self.fail("should have raised an OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             if not e.args[0].startswith("no such collation sequence"):
                 self.fail("wrong OperationalError raised")
 

Modified: python/branches/p3yk/Lib/sqlite3/test/userfunctions.py
==============================================================================
--- python/branches/p3yk/Lib/sqlite3/test/userfunctions.py	(original)
+++ python/branches/p3yk/Lib/sqlite3/test/userfunctions.py	Wed Jan 10 17:19:56 2007
@@ -205,7 +205,7 @@
             cur.execute("select raiseexception()")
             cur.fetchone()
             self.fail("should have raised OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             self.failUnlessEqual(e.args[0], 'user-defined function raised exception')
 
     def CheckParamString(self):
@@ -279,7 +279,7 @@
         try:
             cur.execute("select nostep(t) from test")
             self.fail("should have raised an AttributeError")
-        except AttributeError, e:
+        except AttributeError as e:
             self.failUnlessEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'")
 
     def CheckAggrNoFinalize(self):
@@ -288,7 +288,7 @@
             cur.execute("select nofinalize(t) from test")
             val = cur.fetchone()[0]
             self.fail("should have raised an OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error")
 
     def CheckAggrExceptionInInit(self):
@@ -297,7 +297,7 @@
             cur.execute("select excInit(t) from test")
             val = cur.fetchone()[0]
             self.fail("should have raised an OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error")
 
     def CheckAggrExceptionInStep(self):
@@ -306,7 +306,7 @@
             cur.execute("select excStep(t) from test")
             val = cur.fetchone()[0]
             self.fail("should have raised an OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error")
 
     def CheckAggrExceptionInFinalize(self):
@@ -315,7 +315,7 @@
             cur.execute("select excFinalize(t) from test")
             val = cur.fetchone()[0]
             self.fail("should have raised an OperationalError")
-        except sqlite.OperationalError, e:
+        except sqlite.OperationalError as e:
             self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error")
 
     def CheckAggrCheckParamStr(self):
@@ -384,7 +384,7 @@
     def CheckTableAccess(self):
         try:
             self.con.execute("select * from t2")
-        except sqlite.DatabaseError, e:
+        except sqlite.DatabaseError as e:
             if not e.args[0].endswith("prohibited"):
                 self.fail("wrong exception text: %s" % e.args[0])
             return
@@ -393,7 +393,7 @@
     def CheckColumnAccess(self):
         try:
             self.con.execute("select c2 from t1")
-        except sqlite.DatabaseError, e:
+        except sqlite.DatabaseError as e:
             if not e.args[0].endswith("prohibited"):
                 self.fail("wrong exception text: %s" % e.args[0])
             return

Modified: python/branches/p3yk/Lib/subprocess.py
==============================================================================
--- python/branches/p3yk/Lib/subprocess.py	(original)
+++ python/branches/p3yk/Lib/subprocess.py	Wed Jan 10 17:19:56 2007
@@ -792,7 +792,7 @@
                                          env,
                                          cwd,
                                          startupinfo)
-            except pywintypes.error, e:
+            except pywintypes.error as e:
                 # Translate pywintypes.error to WindowsError, which is
                 # a subclass of OSError.  FIXME: We should really
                 # translate errno using _sys_errlist (or simliar), but
@@ -1190,7 +1190,7 @@
     print "Trying a weird file..."
     try:
         print Popen(["/this/path/does/not/exist"]).communicate()
-    except OSError, e:
+    except OSError as e:
         if e.errno == errno.ENOENT:
             print "The file didn't exist.  I thought so..."
             print "Child traceback:"

Modified: python/branches/p3yk/Lib/tabnanny.py
==============================================================================
--- python/branches/p3yk/Lib/tabnanny.py	(original)
+++ python/branches/p3yk/Lib/tabnanny.py	Wed Jan 10 17:19:56 2007
@@ -43,7 +43,7 @@
     global verbose, filename_only
     try:
         opts, args = getopt.getopt(sys.argv[1:], "qv")
-    except getopt.error, msg:
+    except getopt.error as msg:
         errprint(msg)
         return
     for o, a in opts:
@@ -95,7 +95,7 @@
 
     try:
         f = open(file)
-    except IOError, msg:
+    except IOError as msg:
         errprint("%r: I/O Error: %s" % (file, msg))
         return
 
@@ -105,15 +105,15 @@
     try:
         process_tokens(tokenize.generate_tokens(f.readline))
 
-    except tokenize.TokenError, msg:
+    except tokenize.TokenError as msg:
         errprint("%r: Token Error: %s" % (file, msg))
         return
 
-    except IndentationError, msg:
+    except IndentationError as msg:
         errprint("%r: Indentation Error: %s" % (file, msg))
         return
 
-    except NannyNag, nag:
+    except NannyNag as nag:
         badline = nag.get_lineno()
         line = nag.get_line()
         if verbose:

Modified: python/branches/p3yk/Lib/tarfile.py
==============================================================================
--- python/branches/p3yk/Lib/tarfile.py	(original)
+++ python/branches/p3yk/Lib/tarfile.py	Wed Jan 10 17:19:56 2007
@@ -1540,7 +1540,7 @@
                 self.chown(tarinfo, path)
                 self.utime(tarinfo, path)
                 self.chmod(tarinfo, path)
-            except ExtractError, e:
+            except ExtractError as e:
                 if self.errorlevel > 1:
                     raise
                 else:
@@ -1565,7 +1565,7 @@
 
         try:
             self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
-        except EnvironmentError, e:
+        except EnvironmentError as e:
             if self.errorlevel > 0:
                 raise
             else:
@@ -1573,7 +1573,7 @@
                     self._dbg(1, "tarfile: %s" % e.strerror)
                 else:
                     self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
-        except ExtractError, e:
+        except ExtractError as e:
             if self.errorlevel > 1:
                 raise
             else:
@@ -1681,7 +1681,7 @@
         """
         try:
             os.mkdir(targetpath)
-        except EnvironmentError, e:
+        except EnvironmentError as e:
             if e.errno != errno.EEXIST:
                 raise
 
@@ -1745,11 +1745,11 @@
 
             try:
                 self._extract_member(self.getmember(linkpath), targetpath)
-            except (EnvironmentError, KeyError), e:
+            except (EnvironmentError, KeyError) as e:
                 linkpath = os.path.normpath(linkpath)
                 try:
                     shutil.copy2(linkpath, targetpath)
-                except EnvironmentError, e:
+                except EnvironmentError as e:
                     raise IOError("link could not be created")
 
     def chown(self, tarinfo, targetpath):
@@ -1777,7 +1777,7 @@
                 else:
                     if sys.platform != "os2emx":
                         os.chown(targetpath, u, g)
-            except EnvironmentError, e:
+            except EnvironmentError as e:
                 raise ExtractError("could not change owner")
 
     def chmod(self, tarinfo, targetpath):
@@ -1786,7 +1786,7 @@
         if hasattr(os, 'chmod'):
             try:
                 os.chmod(targetpath, tarinfo.mode)
-            except EnvironmentError, e:
+            except EnvironmentError as e:
                 raise ExtractError("could not change mode")
 
     def utime(self, tarinfo, targetpath):
@@ -1800,7 +1800,7 @@
             return
         try:
             os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
-        except EnvironmentError, e:
+        except EnvironmentError as e:
             raise ExtractError("could not change modification time")
 
     #--------------------------------------------------------------------------
@@ -1833,7 +1833,7 @@
 
                 tarinfo = self.proc_member(tarinfo)
 
-            except HeaderError, e:
+            except HeaderError as e:
                 if self.ignore_zeros:
                     self._dbg(2, "0x%X: %s" % (self.offset, e))
                     self.offset += BLOCKSIZE

Modified: python/branches/p3yk/Lib/telnetlib.py
==============================================================================
--- python/branches/p3yk/Lib/telnetlib.py	(original)
+++ python/branches/p3yk/Lib/telnetlib.py	Wed Jan 10 17:19:56 2007
@@ -227,7 +227,7 @@
             try:
                 self.sock = socket.socket(af, socktype, proto)
                 self.sock.connect(sa)
-            except socket.error, msg:
+            except socket.error as msg:
                 if self.sock:
                     self.sock.close()
                 self.sock = None

Modified: python/branches/p3yk/Lib/tempfile.py
==============================================================================
--- python/branches/p3yk/Lib/tempfile.py	(original)
+++ python/branches/p3yk/Lib/tempfile.py	Wed Jan 10 17:19:56 2007
@@ -201,7 +201,7 @@
                 _os.unlink(filename)
                 del fp, fd
                 return dir
-            except (OSError, IOError), e:
+            except (OSError, IOError) as e:
                 if e[0] != _errno.EEXIST:
                     break # no point trying more names in this directory
                 pass
@@ -236,7 +236,7 @@
             fd = _os.open(file, flags, 0600)
             _set_cloexec(fd)
             return (fd, _os.path.abspath(file))
-        except OSError, e:
+        except OSError as e:
             if e.errno == _errno.EEXIST:
                 continue # try again
             raise
@@ -327,7 +327,7 @@
         try:
             _os.mkdir(file, 0700)
             return file
-        except OSError, e:
+        except OSError as e:
             if e.errno == _errno.EEXIST:
                 continue # try again
             raise

Modified: python/branches/p3yk/Lib/test/pickletester.py
==============================================================================
--- python/branches/p3yk/Lib/test/pickletester.py	(original)
+++ python/branches/p3yk/Lib/test/pickletester.py	Wed Jan 10 17:19:56 2007
@@ -585,7 +585,7 @@
         badpickle = pickle.PROTO + chr(oob) + build_none
         try:
             self.loads(badpickle)
-        except ValueError, detail:
+        except ValueError as detail:
             self.failUnless(str(detail).startswith(
                                             "unsupported pickle protocol"))
         else:

Modified: python/branches/p3yk/Lib/test/regrtest.py
==============================================================================
--- python/branches/p3yk/Lib/test/regrtest.py	(original)
+++ python/branches/p3yk/Lib/test/regrtest.py	Wed Jan 10 17:19:56 2007
@@ -211,7 +211,7 @@
                                     'coverdir=', 'nocoverdir', 'runleaks',
                                     'huntrleaks=', 'verbose2', 'memlimit=',
                                     ])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(2, msg)
 
     # Defaults
@@ -556,19 +556,19 @@
                 dash_R(the_module, test, indirect_test, huntrleaks)
         finally:
             sys.stdout = save_stdout
-    except test_support.ResourceDenied, msg:
+    except test_support.ResourceDenied as msg:
         if not quiet:
             print test, "skipped --", msg
             sys.stdout.flush()
         return -2
-    except (ImportError, test_support.TestSkipped), msg:
+    except (ImportError, test_support.TestSkipped) as msg:
         if not quiet:
             print test, "skipped --", msg
             sys.stdout.flush()
         return -1
     except KeyboardInterrupt:
         raise
-    except test_support.TestFailed, msg:
+    except test_support.TestFailed as msg:
         print "test", test, "failed --", msg
         sys.stdout.flush()
         return 0
@@ -640,7 +640,7 @@
             print "%r left behind %s %r" % (testname, kind, name)
         try:
             nuker(name)
-        except Exception, msg:
+        except Exception as msg:
             print >> sys.stderr, ("%r left behind %s %r and it couldn't be "
                 "removed: %s" % (testname, kind, name, msg))
 

Modified: python/branches/p3yk/Lib/test/sortperf.py
==============================================================================
--- python/branches/p3yk/Lib/test/sortperf.py	(original)
+++ python/branches/p3yk/Lib/test/sortperf.py	Wed Jan 10 17:19:56 2007
@@ -37,7 +37,7 @@
                         os.unlink(fn)
                     except os.error:
                         pass
-        except IOError, msg:
+        except IOError as msg:
             print "can't write", fn, ":", msg
     else:
         result = marshal.load(fp)

Modified: python/branches/p3yk/Lib/test/string_tests.py
==============================================================================
--- python/branches/p3yk/Lib/test/string_tests.py	(original)
+++ python/branches/p3yk/Lib/test/string_tests.py	Wed Jan 10 17:19:56 2007
@@ -970,7 +970,7 @@
             def f():
                 yield 4 + ""
             self.fixtype(' ').join(f())
-        except TypeError, e:
+        except TypeError as e:
             if '+' not in str(e):
                 self.fail('join() ate exception message')
         else:

Modified: python/branches/p3yk/Lib/test/test_bool.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_bool.py	(original)
+++ python/branches/p3yk/Lib/test/test_bool.py	Wed Jan 10 17:19:56 2007
@@ -373,13 +373,11 @@
                     return badval
             try:
                 bool(A())
-            except (Exception), e_bool:
-                pass
-            try:
-                len(A())
-            except (Exception), e_len:
-                pass
-            self.assertEqual(str(e_bool), str(e_len))
+            except (Exception) as e_bool:
+                try:
+                    len(A())
+                except (Exception) as e_len:
+                    self.assertEqual(str(e_bool), str(e_len))
 
 def test_main():
     test_support.run_unittest(BoolTest)

Modified: python/branches/p3yk/Lib/test/test_cfgparser.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_cfgparser.py	(original)
+++ python/branches/p3yk/Lib/test/test_cfgparser.py	Wed Jan 10 17:19:56 2007
@@ -181,7 +181,7 @@
     def get_error(self, exc, section, option):
         try:
             self.cf.get(section, option)
-        except exc, e:
+        except exc as e:
             return e
         else:
             self.fail("expected exception type %s.%s"

Modified: python/branches/p3yk/Lib/test/test_cgi.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_cgi.py	(original)
+++ python/branches/p3yk/Lib/test/test_cgi.py	Wed Jan 10 17:19:56 2007
@@ -50,7 +50,7 @@
         raise ValueError, "unknown method: %s" % method
     try:
         return cgi.parse(fp, env, strict_parsing=1)
-    except StandardError, err:
+    except StandardError as err:
         return ComparableException(err)
 
 # A list of test cases.  Each test case is a a two-tuple that contains

Modified: python/branches/p3yk/Lib/test/test_class.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_class.py	(original)
+++ python/branches/p3yk/Lib/test/test_class.py	Wed Jan 10 17:19:56 2007
@@ -372,7 +372,7 @@
     a = property(booh)
 try:
     A().a # Raised AttributeError: A instance has no attribute 'a'
-except AttributeError, x:
+except AttributeError as x:
     if str(x) != "booh":
         print "attribute error for A().a got masked:", str(x)
 
@@ -384,7 +384,7 @@
     __init__ = property(booh)
 try:
     I() # In debug mode, printed XXX undetected error and raises AttributeError
-except AttributeError, x:
+except AttributeError as x:
     pass
 else:
     print "attribute error for I.__init__ got masked"

Modified: python/branches/p3yk/Lib/test/test_codecs.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_codecs.py	(original)
+++ python/branches/p3yk/Lib/test/test_codecs.py	Wed Jan 10 17:19:56 2007
@@ -595,7 +595,7 @@
         if sys.maxunicode > 0xffff:
             try:
                 "\x00\x00\x00\x00\x00\x11\x11\x00".decode("unicode_internal")
-            except UnicodeDecodeError, ex:
+            except UnicodeDecodeError as ex:
                 self.assertEquals("unicode_internal", ex.encoding)
                 self.assertEquals("\x00\x00\x00\x00\x00\x11\x11\x00", ex.object)
                 self.assertEquals(4, ex.start)
@@ -782,7 +782,7 @@
                 prepped = unicode(prepped, "utf-8")
                 try:
                     self.assertEquals(nameprep(orig), prepped)
-                except Exception,e:
+                except Exception as e:
                     raise test_support.TestFailed("Test 3.%d: %s" % (pos+1, str(e)))
 
 class IDNACodecTest(unittest.TestCase):

Modified: python/branches/p3yk/Lib/test/test_compiler.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_compiler.py	(original)
+++ python/branches/p3yk/Lib/test/test_compiler.py	Wed Jan 10 17:19:56 2007
@@ -44,7 +44,7 @@
                 else:
                     try:
                         compiler.compile(buf, basename, "exec")
-                    except Exception, e:
+                    except Exception as e:
                         args = list(e.args)
                         args[0] += "[in file %s]" % basename
                         e.args = tuple(args)

Modified: python/branches/p3yk/Lib/test/test_contextlib.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_contextlib.py	(original)
+++ python/branches/p3yk/Lib/test/test_contextlib.py	Wed Jan 10 17:19:56 2007
@@ -76,7 +76,7 @@
             state.append(1)
             try:
                 yield 42
-            except ZeroDivisionError, e:
+            except ZeroDivisionError as e:
                 state.append(e.args[0])
                 self.assertEqual(state, [1, 42, 999])
         with woohoo() as x:

Modified: python/branches/p3yk/Lib/test/test_cookielib.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_cookielib.py	(original)
+++ python/branches/p3yk/Lib/test/test_cookielib.py	Wed Jan 10 17:19:56 2007
@@ -257,7 +257,7 @@
             try:
                 c.load(filename="for this test to work, a file with this "
                                 "filename should not exist")
-            except IOError, exc:
+            except IOError as exc:
                 # exactly IOError, not LoadError
                 self.assertEqual(exc.__class__, IOError)
             else:

Modified: python/branches/p3yk/Lib/test/test_dbm.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_dbm.py	(original)
+++ python/branches/p3yk/Lib/test/test_dbm.py	Wed Jan 10 17:19:56 2007
@@ -16,7 +16,8 @@
     for suffix in ['', '.pag', '.dir', '.db']:
         try:
             os.unlink(filename + suffix)
-        except OSError, (errno, strerror):
+        except OSError as e:
+            (errno, strerror) = e
             # if we can't delete the file because of permissions,
             # nothing will work, so skip the test
             if errno == 1:

Modified: python/branches/p3yk/Lib/test/test_decimal.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_decimal.py	(original)
+++ python/branches/p3yk/Lib/test/test_decimal.py	Wed Jan 10 17:19:56 2007
@@ -146,7 +146,7 @@
                 print 'Error in test cases:'
                 print line
                 continue
-            except DecimalException, exception:
+            except DecimalException as exception:
                 #Exception raised where there shoudn't have been one.
                 self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line)
 
@@ -238,7 +238,7 @@
                             funct(self.context.create_decimal(v))
                         except error:
                             pass
-                        except Signals, e:
+                        except Signals as e:
                             self.fail("Raised %s in %s when %s disabled" % \
                                       (e, s, error))
                         else:
@@ -258,7 +258,7 @@
                     funct(*vals)
                 except error:
                     pass
-                except Signals, e:
+                except Signals as e:
                     self.fail("Raised %s in %s when %s disabled" % \
                               (e, s, error))
                 else:
@@ -268,7 +268,7 @@
             result = str(funct(*vals))
             if fname == 'same_quantum':
                 result = str(int(eval(result))) # 'True', 'False' -> '1', '0'
-        except Signals, error:
+        except Signals as error:
             self.fail("Raised %s in %s" % (error, s))
         except: #Catch any error long enough to state the test case.
             print "ERROR:", s

Modified: python/branches/p3yk/Lib/test/test_defaultdict.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_defaultdict.py	(original)
+++ python/branches/p3yk/Lib/test/test_defaultdict.py	Wed Jan 10 17:19:56 2007
@@ -43,7 +43,7 @@
         self.assertEqual(d2.default_factory, None)
         try:
             d2[15]
-        except KeyError, err:
+        except KeyError as err:
             self.assertEqual(err.args, (15,))
         else:
             self.fail("d2[15] didn't raise KeyError")

Modified: python/branches/p3yk/Lib/test/test_descr.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_descr.py	(original)
+++ python/branches/p3yk/Lib/test/test_descr.py	Wed Jan 10 17:19:56 2007
@@ -945,7 +945,7 @@
     def raises(exc, expected, callable, *args):
         try:
             callable(*args)
-        except exc, msg:
+        except exc as msg:
             if not str(msg).startswith(expected):
                 raise TestFailed, "Message %r, expected %r" % (str(msg),
                                                                expected)
@@ -1813,7 +1813,7 @@
     no = NoWeak()
     try:
         weakref.ref(no)
-    except TypeError, msg:
+    except TypeError as msg:
         verify(str(msg).find("weak reference") >= 0)
     else:
         verify(0, "weakref.ref(no) should be illegal")
@@ -1866,7 +1866,7 @@
     for attr in "__doc__", "fget", "fset", "fdel":
         try:
             setattr(raw, attr, 42)
-        except TypeError, msg:
+        except TypeError as msg:
             if str(msg).find('readonly') < 0:
                 raise TestFailed("when setting readonly attr %r on a "
                                  "property, got unexpected TypeError "
@@ -2416,7 +2416,7 @@
         for code in code1, code2, code3:
             try:
                 sandbox.r_exec(code)
-            except IOError, msg:
+            except IOError as msg:
                 if str(msg).find("restricted") >= 0:
                     outcome = "OK"
                 else:
@@ -3523,7 +3523,7 @@
 
     try:
         D.__bases__ = ()
-    except TypeError, msg:
+    except TypeError as msg:
         if str(msg) == "a new-style class can't have only classic bases":
             raise TestFailed, "wrong error message for .__bases__ = ()"
     else:

Modified: python/branches/p3yk/Lib/test/test_dict.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_dict.py	(original)
+++ python/branches/p3yk/Lib/test/test_dict.py	Wed Jan 10 17:19:56 2007
@@ -414,7 +414,7 @@
         e = E()
         try:
             e[42]
-        except RuntimeError, err:
+        except RuntimeError as err:
             self.assertEqual(err.args, (42,))
         else:
             self.fail_("e[42] didn't raise RuntimeError")
@@ -425,7 +425,7 @@
         f = F()
         try:
             f[42]
-        except KeyError, err:
+        except KeyError as err:
             self.assertEqual(err.args, (42,))
         else:
             self.fail_("f[42] didn't raise KeyError")
@@ -434,7 +434,7 @@
         g = G()
         try:
             g[42]
-        except KeyError, err:
+        except KeyError as err:
             self.assertEqual(err.args, (42,))
         else:
             self.fail_("g[42] didn't raise KeyError")
@@ -444,7 +444,7 @@
         d = {}
         try:
             d[(1,)]
-        except KeyError, e:
+        except KeyError as e:
             self.assertEqual(e.args, ((1,),))
         else:
             self.fail("missing KeyError")

Modified: python/branches/p3yk/Lib/test/test_dl.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_dl.py	(original)
+++ python/branches/p3yk/Lib/test/test_dl.py	Wed Jan 10 17:19:56 2007
@@ -18,7 +18,7 @@
         if verbose:
             print 'trying to open:', s,
         l = dl.open(s)
-    except dl.error, err:
+    except dl.error as err:
         if verbose:
             print 'failed', repr(str(err))
         pass

Modified: python/branches/p3yk/Lib/test/test_eof.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_eof.py	(original)
+++ python/branches/p3yk/Lib/test/test_eof.py	Wed Jan 10 17:19:56 2007
@@ -11,7 +11,7 @@
         try:
             eval("""'this is a test\
             """)
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(str(msg), expect)
         else:
             raise test_support.TestFailed
@@ -20,7 +20,7 @@
         expect = "EOF while scanning triple-quoted string (<string>, line 1)"
         try:
             eval("""'''this is a test""")
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(str(msg), expect)
         else:
             raise test_support.TestFailed

Modified: python/branches/p3yk/Lib/test/test_exceptions.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_exceptions.py	(original)
+++ python/branches/p3yk/Lib/test/test_exceptions.py	Wed Jan 10 17:19:56 2007
@@ -21,17 +21,17 @@
         try:
             import exceptions
             reload(exceptions)
-        except ImportError, e:
+        except ImportError as e:
             self.fail("reloading exceptions: %s" % e)
 
     def raise_catch(self, exc, excname):
         try:
             raise exc, "spam"
-        except exc, err:
+        except exc as err:
             buf1 = str(err)
         try:
             raise exc("spam")
-        except exc, err:
+        except exc as err:
             buf2 = str(err)
         self.assertEquals(buf1, buf2)
         self.assertEquals(exc.__name__, excname)
@@ -115,7 +115,7 @@
 
         self.raise_catch(Exception, "Exception")
         try: x = 1/0
-        except Exception, e: pass
+        except Exception as e: pass
 
     def testSyntaxErrorMessage(self):
         # make sure the right exception message is raised for each of
@@ -124,7 +124,7 @@
         def ckmsg(src, msg):
             try:
                 compile(src, '<fragment>', 'exec')
-            except SyntaxError, e:
+            except SyntaxError as e:
                 if e.msg != msg:
                     self.fail("expected %s, got %s" % (msg, e.msg))
             else:
@@ -163,7 +163,7 @@
             import _testcapi
             try:
                 _testcapi.raise_exception(BadException, 1)
-            except TypeError, err:
+            except TypeError as err:
                 exc, err, tb = sys.exc_info()
                 co = tb.tb_frame.f_code
                 self.assertEquals(co.co_name, "test_capi1")
@@ -175,7 +175,7 @@
             import _testcapi
             try:
                 _testcapi.raise_exception(BadException, 0)
-            except RuntimeError, err:
+            except RuntimeError as err:
                 exc, err, tb = sys.exc_info()
                 co = tb.tb_frame.f_code
                 self.assertEquals(co.co_name, "__init__")
@@ -285,7 +285,7 @@
         for exc, args, expected in exceptionList:
             try:
                 raise exc(*args)
-            except BaseException, e:
+            except BaseException as e:
                 if type(e) is not exc:
                     raise
                 # Verify module name
@@ -344,6 +344,16 @@
         self.failUnless(str(Exception('a')))
         self.failUnless(unicode(Exception(u'a')))
 
+    def testExceptionCleanup(self):
+        # Make sure "except V as N" exceptions are cleaned up properly
+        
+        try:
+            raise Exception()
+        except Exception as e:
+            self.failUnless(e)
+            del e
+        self.failIf('e' in locals())
+
 
 def test_main():
     run_unittest(ExceptionTests)

Modified: python/branches/p3yk/Lib/test/test_extcall.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_extcall.py	(original)
+++ python/branches/p3yk/Lib/test/test_extcall.py	Wed Jan 10 17:19:56 2007
@@ -35,21 +35,21 @@
 
 try:
     g()
-except TypeError, err:
+except TypeError as err:
     print "TypeError:", err
 else:
     print "should raise TypeError: not enough arguments; expected 1, got 0"
 
 try:
     g(*())
-except TypeError, err:
+except TypeError as err:
     print "TypeError:", err
 else:
     print "should raise TypeError: not enough arguments; expected 1, got 0"
 
 try:
     g(*(), **{})
-except TypeError, err:
+except TypeError as err:
     print "TypeError:", err
 else:
     print "should raise TypeError: not enough arguments; expected 1, got 0"
@@ -61,7 +61,7 @@
 class Nothing: pass
 try:
     g(*Nothing())
-except TypeError, attr:
+except TypeError as attr:
     pass
 else:
     print "should raise TypeError"
@@ -71,7 +71,7 @@
         return 5
 try:
     g(*Nothing())
-except TypeError, attr:
+except TypeError as attr:
     pass
 else:
     print "should raise TypeError"
@@ -93,7 +93,7 @@
         return self
 try:
     g(*Nothing())
-except TypeError, attr:
+except TypeError as attr:
     pass
 else:
     print "should raise TypeError"
@@ -132,77 +132,77 @@
 
 try:
     g(1, 2, 3, **{'x':4, 'y':5})
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: keyword parameter redefined"
 
 try:
     g(1, 2, 3, a=4, b=5, *(6, 7), **{'a':8, 'b':9})
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: keyword parameter redefined"
 
 try:
     f(**{1:2})
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: keywords must be strings"
 
 try:
     h(**{'e': 2})
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: unexpected keyword argument: e"
 
 try:
     h(*h)
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: * argument must be a tuple"
 
 try:
     dir(*h)
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: * argument must be a tuple"
 
 try:
     None(*h)
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: * argument must be a tuple"
 
 try:
     h(**h)
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: ** argument must be a dictionary"
 
 try:
     dir(**h)
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: ** argument must be a dictionary"
 
 try:
     None(**h)
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: ** argument must be a dictionary"
 
 try:
     dir(b=1,**{'b':1})
-except TypeError, err:
+except TypeError as err:
     print err
 else:
     print "should raise TypeError: dir() got multiple values for keyword argument 'b'"
@@ -226,13 +226,13 @@
 print Foo.method(x, *(1, 2))
 try:
     print Foo.method(*(1, 2, 3))
-except TypeError, err:
+except TypeError as err:
     pass
 else:
     print 'expected a TypeError for unbound method call'
 try:
     print Foo.method(1, *(2, 3))
-except TypeError, err:
+except TypeError as err:
     pass
 else:
     print 'expected a TypeError for unbound method call'
@@ -276,4 +276,4 @@
             for k in kwargs: kwdict[k] = k + k
             print func.func_name, args, sortdict(kwdict), '->',
             try: func(*args, **kwdict)
-            except TypeError, err: print err
+            except TypeError as err: print err

Modified: python/branches/p3yk/Lib/test/test_file.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_file.py	(original)
+++ python/branches/p3yk/Lib/test/test_file.py	Wed Jan 10 17:19:56 2007
@@ -159,7 +159,7 @@
         bad_mode = "qwerty"
         try:
             f = open(TESTFN, bad_mode)
-        except ValueError, msg:
+        except ValueError as msg:
             if msg[0] != 0:
                 s = str(msg)
                 if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
@@ -183,7 +183,7 @@
                 d = int(f.read())
                 f.close()
                 f.close()
-            except IOError, msg:
+            except IOError as msg:
                 self.fail('error setting buffer size %d: %s' % (s, str(msg)))
             self.assertEquals(d, s)
 

Modified: python/branches/p3yk/Lib/test/test_format.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_format.py	(original)
+++ python/branches/p3yk/Lib/test/test_format.py	Wed Jan 10 17:19:56 2007
@@ -199,7 +199,7 @@
 def test_exc(formatstr, args, exception, excmsg):
     try:
         testformat(formatstr, args)
-    except exception, exc:
+    except exception as exc:
         if str(exc) == excmsg:
             if verbose:
                 print "yes"

Modified: python/branches/p3yk/Lib/test/test_frozen.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_frozen.py	(original)
+++ python/branches/p3yk/Lib/test/test_frozen.py	Wed Jan 10 17:19:56 2007
@@ -12,17 +12,17 @@
 
 try:
     import __hello__
-except ImportError, x:
+except ImportError as x:
     raise TestFailed, "import __hello__ failed:" + str(x)
 
 try:
     import __phello__
-except ImportError, x:
+except ImportError as x:
     raise TestFailed, "import __phello__ failed:" + str(x)
 
 try:
     import __phello__.spam
-except ImportError, x:
+except ImportError as x:
     raise TestFailed, "import __phello__.spam failed:" + str(x)
 
 if sys.platform != "mac":  # On the Mac this import does succeed.

Modified: python/branches/p3yk/Lib/test/test_future.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_future.py	(original)
+++ python/branches/p3yk/Lib/test/test_future.py	Wed Jan 10 17:19:56 2007
@@ -29,7 +29,7 @@
     def test_badfuture3(self):
         try:
             from test import badsyntax_future3
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3'))
         else:
             self.fail("expected exception didn't occur")
@@ -37,7 +37,7 @@
     def test_badfuture4(self):
         try:
             from test import badsyntax_future4
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3'))
         else:
             self.fail("expected exception didn't occur")
@@ -45,7 +45,7 @@
     def test_badfuture5(self):
         try:
             from test import badsyntax_future5
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4'))
         else:
             self.fail("expected exception didn't occur")
@@ -53,7 +53,7 @@
     def test_badfuture6(self):
         try:
             from test import badsyntax_future6
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3'))
         else:
             self.fail("expected exception didn't occur")
@@ -61,7 +61,7 @@
     def test_badfuture7(self):
         try:
             from test import badsyntax_future7
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3'))
         else:
             self.fail("expected exception didn't occur")
@@ -69,7 +69,7 @@
     def test_badfuture8(self):
         try:
             from test import badsyntax_future8
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3'))
         else:
             self.fail("expected exception didn't occur")
@@ -77,7 +77,7 @@
     def test_badfuture9(self):
         try:
             from test import badsyntax_future9
-        except SyntaxError, msg:
+        except SyntaxError as msg:
             self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3'))
         else:
             self.fail("expected exception didn't occur")

Modified: python/branches/p3yk/Lib/test/test_generators.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_generators.py	(original)
+++ python/branches/p3yk/Lib/test/test_generators.py	Wed Jan 10 17:19:56 2007
@@ -1554,7 +1554,7 @@
 ...     while True:
 ...         try:
 ...             print (yield)
-...         except ValueError,v:
+...         except ValueError as v:
 ...             print "caught ValueError (%s)" % (v),
 >>> import sys
 >>> g = f()

Modified: python/branches/p3yk/Lib/test/test_grammar.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_grammar.py	(original)
+++ python/branches/p3yk/Lib/test/test_grammar.py	Wed Jan 10 17:19:56 2007
@@ -554,7 +554,7 @@
         assert 1, lambda x:x+1
         try:
             assert 0, "msg"
-        except AssertionError, e:
+        except AssertionError as e:
             self.assertEquals(e.args[0], "msg")
         else:
             if __debug__:
@@ -612,7 +612,7 @@
     def testTry(self):
         ### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite]
         ###         | 'try' ':' suite 'finally' ':' suite
-        ### except_clause: 'except' [expr [',' expr]]
+        ### except_clause: 'except' [expr ['as' expr]]
         try:
             1/0
         except ZeroDivisionError:
@@ -621,14 +621,14 @@
             pass
         try: 1/0
         except EOFError: pass
-        except TypeError, msg: pass
-        except RuntimeError, msg: pass
+        except TypeError as msg: pass
+        except RuntimeError as msg: pass
         except: pass
         else: pass
         try: 1/0
         except (EOFError, TypeError, ZeroDivisionError): pass
         try: 1/0
-        except (EOFError, TypeError, ZeroDivisionError), msg: pass
+        except (EOFError, TypeError, ZeroDivisionError) as msg: pass
         try: pass
         finally: pass
 

Modified: python/branches/p3yk/Lib/test/test_import.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_import.py	(original)
+++ python/branches/p3yk/Lib/test/test_import.py	Wed Jan 10 17:19:56 2007
@@ -55,7 +55,7 @@
             try:
                 try:
                     mod = __import__(TESTFN)
-                except ImportError, err:
+                except ImportError as err:
                     self.fail("import from %s failed: %s" % (ext, err))
 
                 self.assertEquals(mod.a, a,
@@ -68,7 +68,7 @@
             try:
                 try:
                     reload(mod)
-                except ImportError, err:
+                except ImportError as err:
                     self.fail("import from .pyc/.pyo failed: %s" % err)
             finally:
                 try:

Modified: python/branches/p3yk/Lib/test/test_linuxaudiodev.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_linuxaudiodev.py	(original)
+++ python/branches/p3yk/Lib/test/test_linuxaudiodev.py	Wed Jan 10 17:19:56 2007
@@ -27,7 +27,7 @@
 
     try:
         a = linuxaudiodev.open('w')
-    except linuxaudiodev.error, msg:
+    except linuxaudiodev.error as msg:
         if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY):
             raise TestSkipped, msg
         raise TestFailed, msg
@@ -62,27 +62,27 @@
     nchannels = 1
     try:
         a.setparameters(-1, size, nchannels, fmt)
-    except ValueError, msg:
+    except ValueError as msg:
         print msg
     try:
         a.setparameters(rate, -2, nchannels, fmt)
-    except ValueError, msg:
+    except ValueError as msg:
         print msg
     try:
         a.setparameters(rate, size, 3, fmt)
-    except ValueError, msg:
+    except ValueError as msg:
         print msg
     try:
         a.setparameters(rate, size, nchannels, 177)
-    except ValueError, msg:
+    except ValueError as msg:
         print msg
     try:
         a.setparameters(rate, size, nchannels, linuxaudiodev.AFMT_U16_LE)
-    except ValueError, msg:
+    except ValueError as msg:
         print msg
     try:
         a.setparameters(rate, 16, nchannels, fmt)
-    except ValueError, msg:
+    except ValueError as msg:
         print msg
 
 def test():

Modified: python/branches/p3yk/Lib/test/test_nis.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_nis.py	(original)
+++ python/branches/p3yk/Lib/test/test_nis.py	Wed Jan 10 17:19:56 2007
@@ -6,7 +6,7 @@
     def test_maps(self):
         try:
             maps = nis.maps()
-        except nis.error, msg:
+        except nis.error as msg:
             # NIS is probably not active, so this test isn't useful
             if verbose:
                 self.fail("(failing because of verbose mode) %s" % msg)

Modified: python/branches/p3yk/Lib/test/test_opcodes.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_opcodes.py	(original)
+++ python/branches/p3yk/Lib/test/test_opcodes.py	Wed Jan 10 17:19:56 2007
@@ -47,12 +47,12 @@
         b = BClass()
 
         try: raise AClass, b
-        except BClass, v:
+        except BClass as v:
             if v != b: self.fail("v!=b")
         else: self.fail("no exception")
 
         try: raise b
-        except AClass, v:
+        except AClass as v:
             if v != b: self.fail("v!=b AClass")
         else:
             self.fail("no exception")
@@ -63,7 +63,7 @@
         ##else: self.fail("no exception")
 
         try:  raise DClass, a
-        except DClass, v:
+        except DClass as v:
             self.assert_(isinstance(v, DClass))
         else:
             self.fail("no exception")

Modified: python/branches/p3yk/Lib/test/test_optparse.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_optparse.py	(original)
+++ python/branches/p3yk/Lib/test/test_optparse.py	Wed Jan 10 17:19:56 2007
@@ -114,7 +114,7 @@
 
         try:
             func(*args, **kwargs)
-        except expected_exception, err:
+        except expected_exception as err:
             actual_message = str(err)
             if isinstance(expected_message, retype):
                 self.assert_(expected_message.search(actual_message),
@@ -152,7 +152,7 @@
         """
         try:
             self.parser.parse_args(cmdline_args)
-        except InterceptedError, err:
+        except InterceptedError as err:
             self.assertEqual(err.error_message, expected_output)
         else:
             self.assertFalse("expected parse failure")
@@ -175,7 +175,7 @@
                 output = sys.stdout.getvalue()
                 sys.stdout = save_stdout
 
-        except InterceptedError, err:
+        except InterceptedError as err:
             self.assert_(
                 type(output) is types.StringType,
                 "expected output to be an ordinary string, not %r"
@@ -460,7 +460,7 @@
             return int(value)
         else:
             return int(value[:-1]) * _time_units[value[-1]]
-    except ValueError, IndexError:
+    except ValueError as IndexError:
         raise OptionValueError(
             'option %s: invalid duration: %r' % (opt, value))
 

Modified: python/branches/p3yk/Lib/test/test_os.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_os.py	(original)
+++ python/branches/p3yk/Lib/test/test_os.py	Wed Jan 10 17:19:56 2007
@@ -179,7 +179,7 @@
         import statvfs
         try:
             result = os.statvfs(self.fname)
-        except OSError, e:
+        except OSError as e:
             # On AtheOS, glibc always returns ENOSYS
             import errno
             if e.errno == errno.ENOSYS:

Modified: python/branches/p3yk/Lib/test/test_ossaudiodev.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_ossaudiodev.py	(original)
+++ python/branches/p3yk/Lib/test/test_ossaudiodev.py	Wed Jan 10 17:19:56 2007
@@ -48,7 +48,7 @@
 def play_sound_file(data, rate, ssize, nchannels):
     try:
         dsp = ossaudiodev.open('w')
-    except IOError, msg:
+    except IOError as msg:
         if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY):
             raise TestSkipped, msg
         raise TestFailed, msg
@@ -142,7 +142,7 @@
         try:
             result = dsp.setparameters(fmt, channels, rate, True)
             raise AssertionError("setparameters: expected OSSAudioError")
-        except ossaudiodev.OSSAudioError, err:
+        except ossaudiodev.OSSAudioError as err:
             print "setparameters: got OSSAudioError as expected"
 
 def test():

Modified: python/branches/p3yk/Lib/test/test_parser.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_parser.py	(original)
+++ python/branches/p3yk/Lib/test/test_parser.py	Wed Jan 10 17:19:56 2007
@@ -15,7 +15,7 @@
         t = st1.totuple()
         try:
             st2 = parser.sequence2st(t)
-        except parser.ParserError, why:
+        except parser.ParserError as why:
             self.fail("could not roundtrip %r: %s" % (s, why))
 
         self.assertEquals(t, st2.totuple(),

Modified: python/branches/p3yk/Lib/test/test_pep277.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_pep277.py	(original)
+++ python/branches/p3yk/Lib/test/test_pep277.py	Wed Jan 10 17:19:56 2007
@@ -50,7 +50,7 @@
             fn(filename)
             raise test_support.TestFailed("Expected to fail calling '%s(%r)'"
                              % (fn.__name__, filename))
-        except expected_exception, details:
+        except expected_exception as details:
             if check_fn_in_exception and details.filename != filename:
                 raise test_support.TestFailed("Function '%s(%r) failed with "
                                  "bad filename in the exception: %r"

Modified: python/branches/p3yk/Lib/test/test_pyexpat.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_pyexpat.py	(original)
+++ python/branches/p3yk/Lib/test/test_pyexpat.py	Wed Jan 10 17:19:56 2007
@@ -177,7 +177,7 @@
 print "Legal values tested o.k."
 try:
     expat.ParserCreate(namespace_separator=42)
-except TypeError, e:
+except TypeError as e:
     print "Caught expected TypeError:"
     print e
 else:
@@ -185,7 +185,7 @@
 
 try:
     expat.ParserCreate(namespace_separator='too long')
-except ValueError, e:
+except ValueError as e:
     print "Caught expected ValueError:"
     print e
 else:
@@ -321,7 +321,7 @@
 
 try:
     parser.Parse("<a><b><c/></b></a>", 1)
-except RuntimeError, e:
+except RuntimeError as e:
     if e.args[0] != "a":
         print "Expected RuntimeError for element 'a'; found %r" % e.args[0]
 else:

Modified: python/branches/p3yk/Lib/test/test_re.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_re.py	(original)
+++ python/branches/p3yk/Lib/test/test_re.py	Wed Jan 10 17:19:56 2007
@@ -633,7 +633,7 @@
         else:
             try:
                 result = obj.search(s)
-            except re.error, msg:
+            except re.error as msg:
                 print '=== Unexpected exception', t, repr(msg)
             if outcome == SYNTAX_ERROR:
                 # This should have been a syntax error; forget it.

Modified: python/branches/p3yk/Lib/test/test_runpy.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_runpy.py	(original)
+++ python/branches/p3yk/Lib/test/test_runpy.py	Wed Jan 10 17:19:56 2007
@@ -117,7 +117,7 @@
             entry = parts[0]
             try:
                 del sys.modules[entry]
-            except KeyError, ex:
+            except KeyError as ex:
                 if verbose: print ex # Persist with cleaning up
         if verbose: print "  Removed sys.modules entries"
         del sys.path[0]
@@ -126,18 +126,18 @@
             for name in files:
                 try:
                     os.remove(os.path.join(root, name))
-                except OSError, ex:
+                except OSError as ex:
                     if verbose: print ex # Persist with cleaning up
             for name in dirs:
                 fullname = os.path.join(root, name)
                 try:
                     os.rmdir(fullname)
-                except OSError, ex:
+                except OSError as ex:
                     if verbose: print ex # Persist with cleaning up
         try:
             os.rmdir(top)
             if verbose: print "  Removed package tree"
-        except OSError, ex:
+        except OSError as ex:
             if verbose: print ex # Persist with cleaning up
 
     def _check_module(self, depth):

Modified: python/branches/p3yk/Lib/test/test_sax.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_sax.py	(original)
+++ python/branches/p3yk/Lib/test/test_sax.py	Wed Jan 10 17:19:56 2007
@@ -479,7 +479,7 @@
     source.setSystemId(name)
     try:
         parser.parse(source)
-    except SAXException, e:
+    except SAXException as e:
         return e.getSystemId() == name
 
 def test_expat_incomplete():

Modified: python/branches/p3yk/Lib/test/test_set.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_set.py	(original)
+++ python/branches/p3yk/Lib/test/test_set.py	Wed Jan 10 17:19:56 2007
@@ -332,7 +332,7 @@
         for v1 in ['Q', (1,)]:
             try:
                 self.s.remove(v1)
-            except KeyError, e:
+            except KeyError as e:
                 v2 = e.args[0]
                 self.assertEqual(v1, v2)
             else:

Modified: python/branches/p3yk/Lib/test/test_socket.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_socket.py	(original)
+++ python/branches/p3yk/Lib/test/test_socket.py	Wed Jan 10 17:19:56 2007
@@ -129,7 +129,7 @@
             raise TypeError, "test_func must be a callable function"
         try:
             test_func()
-        except Exception, strerror:
+        except Exception as strerror:
             self.queue.put(strerror)
         self.clientTearDown()
 

Modified: python/branches/p3yk/Lib/test/test_socket_ssl.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_socket_ssl.py	(original)
+++ python/branches/p3yk/Lib/test/test_socket_ssl.py	Wed Jan 10 17:19:56 2007
@@ -58,7 +58,7 @@
     except socket.timeout:
         error_msg('timed out')
         return
-    except socket.error, exc:  # In case connection is refused.
+    except socket.error as exc:  # In case connection is refused.
         if exc.args[0] == errno.ECONNREFUSED:
             error_msg('was refused')
             return

Modified: python/branches/p3yk/Lib/test/test_socketserver.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_socketserver.py	(original)
+++ python/branches/p3yk/Lib/test/test_socketserver.py	Wed Jan 10 17:19:56 2007
@@ -155,7 +155,8 @@
                 self.server_address = host, port
                 TCPServer.server_bind(self)
                 break
-            except socket.error, (err, msg):
+            except socket.error as e:
+                (err, msg) = e
                 if err != errno.EADDRINUSE:
                     raise
                 print >>sys.__stderr__, \

Modified: python/branches/p3yk/Lib/test/test_strftime.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_strftime.py	(original)
+++ python/branches/p3yk/Lib/test/test_strftime.py	Wed Jan 10 17:19:56 2007
@@ -119,7 +119,7 @@
     for e in expectations:
         try:
             result = time.strftime(e[0], now)
-        except ValueError, error:
+        except ValueError as error:
             print "Standard '%s' format gave error:" % e[0], error
             continue
         if re.match(escapestr(e[1], ampm), result): continue
@@ -132,7 +132,7 @@
     for e in nonstandard_expectations:
         try:
             result = time.strftime(e[0], now)
-        except ValueError, result:
+        except ValueError as result:
             if verbose:
                 print "Error for nonstandard '%s' format (%s): %s" % \
                       (e[0], e[2], str(result))

Modified: python/branches/p3yk/Lib/test/test_string.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_string.py	(original)
+++ python/branches/p3yk/Lib/test/test_string.py	Wed Jan 10 17:19:56 2007
@@ -55,7 +55,7 @@
             def f():
                 yield 4 + ""
             self.fixtype(' ').join(f())
-        except TypeError, e:
+        except TypeError as e:
             if '+' not in str(e):
                 self.fail('join() ate exception message')
         else:

Modified: python/branches/p3yk/Lib/test/test_strptime.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_strptime.py	(original)
+++ python/branches/p3yk/Lib/test/test_strptime.py	Wed Jan 10 17:19:56 2007
@@ -206,7 +206,7 @@
                 _strptime.strptime("2005", bad_format)
             except ValueError:
                 continue
-            except Exception, err:
+            except Exception as err:
                 self.fail("'%s' raised %s, not ValueError" %
                             (bad_format, err.__class__.__name__))
             else:

Modified: python/branches/p3yk/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_subprocess.py	(original)
+++ python/branches/p3yk/Lib/test/test_subprocess.py	Wed Jan 10 17:19:56 2007
@@ -67,7 +67,7 @@
         try:
             subprocess.check_call([sys.executable, "-c",
                                    "import sys; sys.exit(47)"])
-        except subprocess.CalledProcessError, e:
+        except subprocess.CalledProcessError as e:
             self.assertEqual(e.returncode, 47)
         else:
             self.fail("Expected CalledProcessError")
@@ -475,7 +475,7 @@
             try:
                 p = subprocess.Popen([sys.executable, "-c", ""],
                                  cwd="/this/path/does/not/exist")
-            except OSError, e:
+            except OSError as e:
                 # The attribute child_traceback should contain "os.chdir"
                 # somewhere.
                 self.assertNotEqual(e.child_traceback.find("os.chdir"), -1)

Modified: python/branches/p3yk/Lib/test/test_sunaudiodev.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_sunaudiodev.py	(original)
+++ python/branches/p3yk/Lib/test/test_sunaudiodev.py	Wed Jan 10 17:19:56 2007
@@ -16,7 +16,7 @@
     fp.close()
     try:
         a = sunaudiodev.open('w')
-    except sunaudiodev.error, msg:
+    except sunaudiodev.error as msg:
         raise TestFailed, msg
     else:
         a.write(data)

Modified: python/branches/p3yk/Lib/test/test_support.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_support.py	(original)
+++ python/branches/p3yk/Lib/test/test_support.py	Wed Jan 10 17:19:56 2007
@@ -102,7 +102,8 @@
         try:
             sock.bind((host, port))
             return port
-        except socket.error, (err, msg):
+        except socket.error as e:
+            (err, msg) = e
             if err != errno.EADDRINUSE:
                 raise
             print >>sys.__stderr__, \

Modified: python/branches/p3yk/Lib/test/test_syntax.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_syntax.py	(original)
+++ python/branches/p3yk/Lib/test/test_syntax.py	Wed Jan 10 17:19:56 2007
@@ -387,7 +387,7 @@
         """
         try:
             compile(code, filename, mode)
-        except SyntaxError, err:
+        except SyntaxError as err:
             if subclass and not isinstance(err, subclass):
                 self.fail("SyntaxError is not a %s" % subclass.__name__)
             mo = re.search(errtext, str(err))

Modified: python/branches/p3yk/Lib/test/test_sys.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_sys.py	(original)
+++ python/branches/p3yk/Lib/test/test_sys.py	Wed Jan 10 17:19:56 2007
@@ -54,7 +54,7 @@
         self.assertRaises(TypeError, eh)
         try:
             raise ValueError(42)
-        except ValueError, exc:
+        except ValueError as exc:
             eh(*sys.exc_info())
 
         sys.stderr = savestderr
@@ -84,7 +84,7 @@
         def clear():
             try:
                 raise ValueError, 42
-            except ValueError, exc:
+            except ValueError as exc:
                 clear_check(exc)
 
         # Raise an exception and check that it can be cleared
@@ -94,7 +94,7 @@
         # unaffected by calling exc_clear in a nested frame.
         try:
             raise ValueError, 13
-        except ValueError, exc:
+        except ValueError as exc:
             typ1, value1, traceback1 = sys.exc_info()
             clear()
             typ2, value2, traceback2 = sys.exc_info()
@@ -104,16 +104,13 @@
             self.assert_(value1 is value2)
             self.assert_(traceback1 is traceback2)
 
-        # Check that an exception can be cleared outside of an except block
-        clear_check(exc)
-
     def test_exit(self):
         self.assertRaises(TypeError, sys.exit, 42, 42)
 
         # call without argument
         try:
             sys.exit(0)
-        except SystemExit, exc:
+        except SystemExit as exc:
             self.assertEquals(exc.code, 0)
         except:
             self.fail("wrong exception")
@@ -124,7 +121,7 @@
         # entry will be unpacked
         try:
             sys.exit(42)
-        except SystemExit, exc:
+        except SystemExit as exc:
             self.assertEquals(exc.code, 42)
         except:
             self.fail("wrong exception")
@@ -134,7 +131,7 @@
         # call with integer argument
         try:
             sys.exit((42,))
-        except SystemExit, exc:
+        except SystemExit as exc:
             self.assertEquals(exc.code, 42)
         except:
             self.fail("wrong exception")
@@ -144,7 +141,7 @@
         # call with string argument
         try:
             sys.exit("exit")
-        except SystemExit, exc:
+        except SystemExit as exc:
             self.assertEquals(exc.code, "exit")
         except:
             self.fail("wrong exception")
@@ -154,7 +151,7 @@
         # call with tuple argument with two entries
         try:
             sys.exit((17, 23))
-        except SystemExit, exc:
+        except SystemExit as exc:
             self.assertEquals(exc.code, (17, 23))
         except:
             self.fail("wrong exception")

Modified: python/branches/p3yk/Lib/test/test_tarfile.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_tarfile.py	(original)
+++ python/branches/p3yk/Lib/test/test_tarfile.py	Wed Jan 10 17:19:56 2007
@@ -545,7 +545,7 @@
         try:
             # Extract 1-LNKTYPE which is a hardlink to 0-REGTYPE
             self.tar.extract("1-LNKTYPE", dirname())
-        except EnvironmentError, e:
+        except EnvironmentError as e:
             import errno
             if e.errno == errno.ENOENT:
                 self.fail("hardlink not extracted properly")

Modified: python/branches/p3yk/Lib/test/test_tcl.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_tcl.py	(original)
+++ python/branches/p3yk/Lib/test/test_tcl.py	Wed Jan 10 17:19:56 2007
@@ -107,7 +107,7 @@
         filename = "doesnotexists"
         try:
             os.remove(filename)
-        except Exception,e:
+        except Exception as e:
             pass
         self.assertRaises(TclError,tcl.evalfile,filename)
 

Modified: python/branches/p3yk/Lib/test/test_trace.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_trace.py	(original)
+++ python/branches/p3yk/Lib/test/test_trace.py	Wed Jan 10 17:19:56 2007
@@ -97,7 +97,7 @@
 def test_raise():
     try:
         raises()
-    except Exception, exc:
+    except Exception as exc:
         x = 1
 
 test_raise.events = [(0, 'call'),
@@ -127,7 +127,7 @@
 def settrace_and_raise(tracefunc):
     try:
         _settrace_and_raise(tracefunc)
-    except RuntimeError, exc:
+    except RuntimeError as exc:
         pass
 
 settrace_and_raise.events = [(2, 'exception'),
@@ -432,7 +432,7 @@
     try:
         output.append(2)
         output.append(3)
-    except ValueError, e:
+    except ValueError as e:
         output.append('after' in str(e))
 
 no_jump_too_far_forwards.jump = (3, 6)
@@ -442,7 +442,7 @@
     try:
         output.append(2)
         output.append(3)
-    except ValueError, e:
+    except ValueError as e:
         output.append('before' in str(e))
 
 no_jump_too_far_backwards.jump = (3, -1)
@@ -472,7 +472,7 @@
 def no_jump_to_except_3(output):
     try:
         output.append(2)
-    except ValueError, e:
+    except ValueError as e:
         output.append('except' in str(e))
 
 no_jump_to_except_3.jump = (2, 3)
@@ -481,7 +481,7 @@
 def no_jump_to_except_4(output):
     try:
         output.append(2)
-    except (ValueError, RuntimeError), e:
+    except (ValueError, RuntimeError) as e:
         output.append('except' in str(e))
 
 no_jump_to_except_4.jump = (2, 3)
@@ -492,7 +492,7 @@
         output.append(2)
         for i in 1, 2:
             output.append(4)
-    except ValueError, e:
+    except ValueError as e:
         output.append('into' in str(e))
 
 no_jump_forwards_into_block.jump = (2, 4)
@@ -503,7 +503,7 @@
         for i in 1, 2:
             output.append(3)
         output.append(4)
-    except ValueError, e:
+    except ValueError as e:
         output.append('into' in str(e))
 
 no_jump_backwards_into_block.jump = (4, 3)
@@ -516,7 +516,7 @@
             x = 1
         finally:
             output.append(6)
-    except ValueError, e:
+    except ValueError as e:
         output.append('finally' in str(e))
 
 no_jump_into_finally_block.jump = (4, 6)
@@ -529,7 +529,7 @@
         finally:
             output.append(5)
             output.append(6)
-    except ValueError, e:
+    except ValueError as e:
         output.append('finally' in str(e))
 
 no_jump_out_of_finally_block.jump = (5, 1)
@@ -539,7 +539,7 @@
 def no_jump_to_non_integers(output):
     try:
         output.append(2)
-    except ValueError, e:
+    except ValueError as e:
         output.append('integer' in str(e))
 
 no_jump_to_non_integers.jump = (2, "Spam")
@@ -551,7 +551,7 @@
     try:
         previous_frame = sys._getframe().f_back
         previous_frame.f_lineno = previous_frame.f_lineno
-    except ValueError, e:
+    except ValueError as e:
         # This is the exception we wanted; make sure the error message
         # talks about trace functions.
         if 'trace' not in str(e):

Modified: python/branches/p3yk/Lib/test/test_traceback.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_traceback.py	(original)
+++ python/branches/p3yk/Lib/test/test_traceback.py	Wed Jan 10 17:19:56 2007
@@ -12,7 +12,7 @@
     def get_exception_format(self, func, exc):
         try:
             func()
-        except exc, value:
+        except exc as value:
             return traceback.format_exception_only(exc, value)
         else:
             raise ValueError, "call did not raise exception"

Modified: python/branches/p3yk/Lib/test/test_urllib2net.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_urllib2net.py	(original)
+++ python/branches/p3yk/Lib/test/test_urllib2net.py	Wed Jan 10 17:19:56 2007
@@ -236,7 +236,7 @@
             debug(url)
             try:
                 f = urllib2.urlopen(url, req)
-            except (IOError, socket.error, OSError), err:
+            except (IOError, socket.error, OSError) as err:
                 debug(err)
                 if expected_err:
                     msg = ("Didn't get expected error(s) %s for %s %s, got %s" %

Modified: python/branches/p3yk/Lib/test/test_userdict.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_userdict.py	(original)
+++ python/branches/p3yk/Lib/test/test_userdict.py	Wed Jan 10 17:19:56 2007
@@ -168,7 +168,7 @@
         e = E()
         try:
             e[42]
-        except RuntimeError, err:
+        except RuntimeError as err:
             self.assertEqual(err.args, (42,))
         else:
             self.fail_("e[42] didn't raise RuntimeError")
@@ -180,7 +180,7 @@
         f = F()
         try:
             f[42]
-        except KeyError, err:
+        except KeyError as err:
             self.assertEqual(err.args, (42,))
         else:
             self.fail_("f[42] didn't raise KeyError")
@@ -189,7 +189,7 @@
         g = G()
         try:
             g[42]
-        except KeyError, err:
+        except KeyError as err:
             self.assertEqual(err.args, (42,))
         else:
             self.fail_("g[42] didn't raise KeyError")

Modified: python/branches/p3yk/Lib/test/test_uu.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_uu.py	(original)
+++ python/branches/p3yk/Lib/test/test_uu.py	Wed Jan 10 17:19:56 2007
@@ -50,7 +50,7 @@
         try:
             uu.decode(inp, out)
             self.fail("No exception thrown")
-        except uu.Error, e:
+        except uu.Error as e:
             self.assertEqual(str(e), "Truncated input file")
 
     def test_missingbegin(self):
@@ -59,7 +59,7 @@
         try:
             uu.decode(inp, out)
             self.fail("No exception thrown")
-        except uu.Error, e:
+        except uu.Error as e:
             self.assertEqual(str(e), "No valid begin line found in input file")
 
 class UUStdIOTest(unittest.TestCase):

Modified: python/branches/p3yk/Lib/test/test_winreg.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_winreg.py	(original)
+++ python/branches/p3yk/Lib/test/test_winreg.py	Wed Jan 10 17:19:56 2007
@@ -142,7 +142,7 @@
 if remote_name is not None:
     try:
         remote_key = ConnectRegistry(remote_name, HKEY_CURRENT_USER)
-    except EnvironmentError, exc:
+    except EnvironmentError as exc:
         print "Could not connect to the remote machine -", exc.strerror
         remote_key = None
     if remote_key is not None:

Modified: python/branches/p3yk/Lib/timeit.py
==============================================================================
--- python/branches/p3yk/Lib/timeit.py	(original)
+++ python/branches/p3yk/Lib/timeit.py	Wed Jan 10 17:19:56 2007
@@ -209,7 +209,7 @@
         opts, args = getopt.getopt(args, "n:s:r:tcvh",
                                    ["number=", "setup=", "repeat=",
                                     "time", "clock", "verbose", "help"])
-    except getopt.error, err:
+    except getopt.error as err:
         print err
         print "use -h/--help for command line help"
         return 2

Modified: python/branches/p3yk/Lib/toaiff.py
==============================================================================
--- python/branches/p3yk/Lib/toaiff.py	(original)
+++ python/branches/p3yk/Lib/toaiff.py	Wed Jan 10 17:19:56 2007
@@ -87,7 +87,7 @@
         ftype = sndhdr.whathdr(fname)
         if ftype:
             ftype = ftype[0] # All we're interested in
-    except IOError, msg:
+    except IOError as msg:
         if type(msg) == type(()) and len(msg) == 2 and \
                 type(msg[0]) == type(0) and type(msg[1]) == type(''):
             msg = msg[1]

Modified: python/branches/p3yk/Lib/token.py
==============================================================================
--- python/branches/p3yk/Lib/token.py	(original)
+++ python/branches/p3yk/Lib/token.py	Wed Jan 10 17:19:56 2007
@@ -93,7 +93,7 @@
         outFileName = args[1]
     try:
         fp = open(inFileName)
-    except IOError, err:
+    except IOError as err:
         sys.stdout.write("I/O error: %s\n" % str(err))
         sys.exit(1)
     lines = fp.read().split("\n")
@@ -113,7 +113,7 @@
     # load the output skeleton from the target:
     try:
         fp = open(outFileName)
-    except IOError, err:
+    except IOError as err:
         sys.stderr.write("I/O error: %s\n" % str(err))
         sys.exit(2)
     format = fp.read().split("\n")
@@ -130,7 +130,7 @@
     format[start:end] = lines
     try:
         fp = open(outFileName, 'w')
-    except IOError, err:
+    except IOError as err:
         sys.stderr.write("I/O error: %s\n" % str(err))
         sys.exit(4)
     fp.write("\n".join(format))

Modified: python/branches/p3yk/Lib/trace.py
==============================================================================
--- python/branches/p3yk/Lib/trace.py	(original)
+++ python/branches/p3yk/Lib/trace.py	Wed Jan 10 17:19:56 2007
@@ -220,7 +220,7 @@
                 counts, calledfuncs, callers = \
                         pickle.load(open(self.infile, 'rb'))
                 self.update(self.__class__(counts, calledfuncs, callers))
-            except (IOError, EOFError, ValueError), err:
+            except (IOError, EOFError, ValueError) as err:
                 print >> sys.stderr, ("Skipping counts file %r: %s"
                                       % (self.infile, err))
 
@@ -328,7 +328,7 @@
             try:
                 pickle.dump((self.counts, self.calledfuncs, self.callers),
                             open(self.outfile, 'wb'), 1)
-            except IOError, err:
+            except IOError as err:
                 print >> sys.stderr, "Can't save counts files because %s" % err
 
     def write_results_file(self, path, lines, lnotab, lines_hit):
@@ -336,7 +336,7 @@
 
         try:
             outfile = open(path, "w")
-        except IOError, err:
+        except IOError as err:
             print >> sys.stderr, ("trace: Could not open %r for writing: %s"
                                   "- skipping" % (path, err))
             return 0, 0
@@ -422,7 +422,7 @@
     """Return dict where keys are line numbers in the line number table."""
     try:
         prog = open(filename, "rU").read()
-    except IOError, err:
+    except IOError as err:
         print >> sys.stderr, ("Not printing coverage data for %r: %s"
                               % (filename, err))
         return {}
@@ -658,7 +658,7 @@
                                          "coverdir=", "listfuncs",
                                          "trackcalls"])
 
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stderr.write("%s: %s\n" % (sys.argv[0], msg))
         sys.stderr.write("Try `%s --help' for more information\n"
                          % sys.argv[0])
@@ -778,7 +778,7 @@
                   outfile=counts_file)
         try:
             t.run('execfile(%r)' % (progname,))
-        except IOError, err:
+        except IOError as err:
             _err_exit("Cannot run file %r because: %s" % (sys.argv[0], err))
         except SystemExit:
             pass

Modified: python/branches/p3yk/Lib/unittest.py
==============================================================================
--- python/branches/p3yk/Lib/unittest.py	(original)
+++ python/branches/p3yk/Lib/unittest.py	Wed Jan 10 17:19:56 2007
@@ -783,7 +783,7 @@
             else:
                 self.testNames = (self.defaultTest,)
             self.createTests()
-        except getopt.error, msg:
+        except getopt.error as msg:
             self.usageExit(msg)
 
     def createTests(self):

Modified: python/branches/p3yk/Lib/urllib.py
==============================================================================
--- python/branches/p3yk/Lib/urllib.py	(original)
+++ python/branches/p3yk/Lib/urllib.py	Wed Jan 10 17:19:56 2007
@@ -190,7 +190,7 @@
                 return getattr(self, name)(url)
             else:
                 return getattr(self, name)(url, data)
-        except socket.error, msg:
+        except socket.error as msg:
             raise IOError, ('socket error', msg), sys.exc_info()[2]
 
     def open_unknown(self, fullurl, data=None):
@@ -217,7 +217,7 @@
                 hdrs = fp.info()
                 del fp
                 return url2pathname(splithost(url1)[1]), hdrs
-            except IOError, msg:
+            except IOError as msg:
                 pass
         fp = self.open(url, data)
         headers = fp.info()
@@ -461,7 +461,7 @@
         localname = url2pathname(file)
         try:
             stats = os.stat(localname)
-        except OSError, e:
+        except OSError as e:
             raise IOError(e.errno, e.strerror, e.filename)
         size = stats.st_size
         modified = email.Utils.formatdate(stats.st_mtime, usegmt=True)
@@ -544,7 +544,7 @@
                 headers += "Content-Length: %d\n" % retrlen
             headers = mimetools.Message(StringIO(headers))
             return addinfourl(fp, headers, "ftp:" + url)
-        except ftperrors(), msg:
+        except ftperrors() as msg:
             raise IOError, ('ftp error', msg), sys.exc_info()[2]
 
     def open_data(self, url, data=None):
@@ -861,7 +861,7 @@
             try:
                 cmd = 'RETR ' + file
                 conn = self.ftp.ntransfercmd(cmd)
-            except ftplib.error_perm, reason:
+            except ftplib.error_perm as reason:
                 if str(reason)[:3] != '550':
                     raise IOError, ('ftp error', reason), sys.exc_info()[2]
         if not conn:
@@ -1503,7 +1503,7 @@
     import getopt, sys
     try:
         opts, args = getopt.getopt(sys.argv[1:], "th")
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print "Use -h for help"
         return

Modified: python/branches/p3yk/Lib/urllib2.py
==============================================================================
--- python/branches/p3yk/Lib/urllib2.py	(original)
+++ python/branches/p3yk/Lib/urllib2.py	Wed Jan 10 17:19:56 2007
@@ -1072,7 +1072,7 @@
         try:
             h.request(req.get_method(), req.get_selector(), req.data, headers)
             r = h.getresponse()
-        except socket.error, err: # XXX what error?
+        except socket.error as err: # XXX what error?
             raise URLError(err)
 
         # Pick apart the HTTPResponse object to get the addinfourl
@@ -1254,7 +1254,7 @@
 
         try:
             host = socket.gethostbyname(host)
-        except socket.error, msg:
+        except socket.error as msg:
             raise URLError(msg)
         path, attrs = splitattr(req.get_selector())
         dirs = path.split('/')
@@ -1280,7 +1280,7 @@
             sf = StringIO(headers)
             headers = mimetools.Message(sf)
             return addinfourl(fp, headers, req.get_full_url())
-        except ftplib.all_errors, msg:
+        except ftplib.all_errors as msg:
             raise IOError, ('ftp error', msg), sys.exc_info()[2]
 
     def connect_ftp(self, user, passwd, host, port, dirs):

Modified: python/branches/p3yk/Lib/uu.py
==============================================================================
--- python/branches/p3yk/Lib/uu.py	(original)
+++ python/branches/p3yk/Lib/uu.py	Wed Jan 10 17:19:56 2007
@@ -132,7 +132,7 @@
     while s and s.strip() != 'end':
         try:
             data = binascii.a2b_uu(s)
-        except binascii.Error, v:
+        except binascii.Error as v:
             # Workaround for broken uuencoders by /Fredrik Lundh
             nbytes = (((ord(s[0])-32) & 63) * 4 + 5) // 3
             data = binascii.a2b_uu(s[:nbytes])

Modified: python/branches/p3yk/Lib/warnings.py
==============================================================================
--- python/branches/p3yk/Lib/warnings.py	(original)
+++ python/branches/p3yk/Lib/warnings.py	Wed Jan 10 17:19:56 2007
@@ -192,7 +192,7 @@
     for arg in args:
         try:
             _setoption(arg)
-        except _OptionError, msg:
+        except _OptionError as msg:
             print >>sys.stderr, "Invalid -W option ignored:", msg
 
 # Helper for _processoptions()

Modified: python/branches/p3yk/Lib/webbrowser.py
==============================================================================
--- python/branches/p3yk/Lib/webbrowser.py	(original)
+++ python/branches/p3yk/Lib/webbrowser.py	Wed Jan 10 17:19:56 2007
@@ -625,7 +625,7 @@
     -t: open new tab""" % sys.argv[0]
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'ntd')
-    except getopt.error, msg:
+    except getopt.error as msg:
         print >>sys.stderr, msg
         print >>sys.stderr, usage
         sys.exit(1)

Modified: python/branches/p3yk/Lib/xdrlib.py
==============================================================================
--- python/branches/p3yk/Lib/xdrlib.py	(original)
+++ python/branches/p3yk/Lib/xdrlib.py	Wed Jan 10 17:19:56 2007
@@ -68,12 +68,12 @@
 
     def pack_float(self, x):
         try: self.__buf.write(struct.pack('>f', x))
-        except struct.error, msg:
+        except struct.error as msg:
             raise ConversionError, msg
 
     def pack_double(self, x):
         try: self.__buf.write(struct.pack('>d', x))
-        except struct.error, msg:
+        except struct.error as msg:
             raise ConversionError, msg
 
     def pack_fstring(self, n, s):

Modified: python/branches/p3yk/Lib/xml/sax/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/xml/sax/__init__.py	(original)
+++ python/branches/p3yk/Lib/xml/sax/__init__.py	Wed Jan 10 17:19:56 2007
@@ -79,7 +79,7 @@
     for parser_name in parser_list + default_parser_list:
         try:
             return _create_parser(parser_name)
-        except ImportError,e:
+        except ImportError as e:
             import sys
             if parser_name in sys.modules:
                 # The parser module was found, but importing it

Modified: python/branches/p3yk/Lib/xml/sax/expatreader.py
==============================================================================
--- python/branches/p3yk/Lib/xml/sax/expatreader.py	(original)
+++ python/branches/p3yk/Lib/xml/sax/expatreader.py	Wed Jan 10 17:19:56 2007
@@ -205,7 +205,7 @@
             # document. When feeding chunks, they are not normally final -
             # except when invoked from close.
             self._parser.Parse(data, isFinal)
-        except expat.error, e:
+        except expat.error as e:
             exc = SAXParseException(expat.ErrorString(e.code), e, self)
             # FIXME: when to invoke error()?
             self._err_handler.fatalError(exc)

Modified: python/branches/p3yk/Lib/xmllib.py
==============================================================================
--- python/branches/p3yk/Lib/xmllib.py	(original)
+++ python/branches/p3yk/Lib/xmllib.py	Wed Jan 10 17:19:56 2007
@@ -896,7 +896,7 @@
     else:
         try:
             f = open(file, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print file, ":", msg
             sys.exit(1)
 
@@ -914,7 +914,7 @@
             for c in data:
                 x.feed(c)
             x.close()
-    except Error, msg:
+    except Error as msg:
         t1 = time()
         print msg
         if do_time:

Modified: python/branches/p3yk/Lib/xmlrpclib.py
==============================================================================
--- python/branches/p3yk/Lib/xmlrpclib.py	(original)
+++ python/branches/p3yk/Lib/xmlrpclib.py	Wed Jan 10 17:19:56 2007
@@ -1454,7 +1454,7 @@
 
     try:
         print server.currentTime.getCurrentTime()
-    except Error, v:
+    except Error as v:
         print "ERROR", v
 
     multi = MultiCall(server)
@@ -1463,5 +1463,5 @@
     try:
         for response in multi():
             print response
-    except Error, v:
+    except Error as v:
         print "ERROR", v

Modified: python/branches/p3yk/Lib/zipfile.py
==============================================================================
--- python/branches/p3yk/Lib/zipfile.py	(original)
+++ python/branches/p3yk/Lib/zipfile.py	Wed Jan 10 17:19:56 2007
@@ -812,7 +812,7 @@
                 print "Compiling", file_py
             try:
                 py_compile.compile(file_py, file_pyc, None, True)
-            except py_compile.PyCompileError,err:
+            except py_compile.PyCompileError as err:
                 print err.msg
             fname = file_pyc
         else:

Modified: python/branches/p3yk/Mac/BuildScript/build-installer.py
==============================================================================
--- python/branches/p3yk/Mac/BuildScript/build-installer.py	(original)
+++ python/branches/p3yk/Mac/BuildScript/build-installer.py	Wed Jan 10 17:19:56 2007
@@ -335,7 +335,7 @@
     try:
         options, args = getopt.getopt(args, '?hb',
                 [ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir='])
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         sys.exit(1)
 

Modified: python/branches/p3yk/Mac/Demo/applescript/makedisk.py
==============================================================================
--- python/branches/p3yk/Mac/Demo/applescript/makedisk.py	(original)
+++ python/branches/p3yk/Mac/Demo/applescript/makedisk.py	Wed Jan 10 17:19:56 2007
@@ -7,7 +7,7 @@
 filespec = macfs.FSSpec('my disk image.img')
 try:
     objref = talker.create('my disk image', saving_as=filespec, leave_image_mounted=1)
-except Disk_Copy.Error, arg:
+except Disk_Copy.Error as arg:
     print "ERROR: my disk image:", arg
 else:
     print 'objref=', objref

Modified: python/branches/p3yk/Mac/Demo/imgbrowse/imgbrowse.py
==============================================================================
--- python/branches/p3yk/Mac/Demo/imgbrowse/imgbrowse.py	(original)
+++ python/branches/p3yk/Mac/Demo/imgbrowse/imgbrowse.py	Wed Jan 10 17:19:56 2007
@@ -52,7 +52,7 @@
         bar = EasyDialogs.ProgressBar('Reading and converting...')
         try:
             rdr = img.reader(imgformat.macrgb16, pathname)
-        except img.error, arg:
+        except img.error as arg:
             EasyDialogs.Message(repr(arg))
             return
         w, h = rdr.width, rdr.height

Modified: python/branches/p3yk/Mac/Demo/mlte/mlted.py
==============================================================================
--- python/branches/p3yk/Mac/Demo/mlte/mlted.py	(original)
+++ python/branches/p3yk/Mac/Demo/mlte/mlted.py	Wed Jan 10 17:19:56 2007
@@ -275,7 +275,7 @@
                 fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
                 data = fp.read()
                 fp.close()
-            except IOError, arg:
+            except IOError as arg:
                 EasyDialogs.Message("IOERROR: %r" % (arg,))
                 return
         else:

Modified: python/branches/p3yk/Mac/Demo/resources/copyres.py
==============================================================================
--- python/branches/p3yk/Mac/Demo/resources/copyres.py	(original)
+++ python/branches/p3yk/Mac/Demo/resources/copyres.py	Wed Jan 10 17:19:56 2007
@@ -39,7 +39,7 @@
             UseResFile(output)
             try:
                 res2 = Get1Resource(type, id)
-            except (RuntimeError, Res.Error), msg:
+            except (RuntimeError, Res.Error) as msg:
                 res2 = None
             if res2:
                 print "Duplicate type+id, not copied"

Modified: python/branches/p3yk/Mac/Demo/textedit/ped.py
==============================================================================
--- python/branches/p3yk/Mac/Demo/textedit/ped.py	(original)
+++ python/branches/p3yk/Mac/Demo/textedit/ped.py	Wed Jan 10 17:19:56 2007
@@ -273,7 +273,7 @@
                 fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
                 data = fp.read()
                 fp.close()
-            except IOError, arg:
+            except IOError as arg:
                 EasyDialogs.Message("IOERROR: %r" % (arg,))
                 return
         else:

Modified: python/branches/p3yk/Mac/scripts/BuildApplet.py
==============================================================================
--- python/branches/p3yk/Mac/scripts/BuildApplet.py	(original)
+++ python/branches/p3yk/Mac/scripts/BuildApplet.py	Wed Jan 10 17:19:56 2007
@@ -31,7 +31,7 @@
 def main():
     try:
         buildapplet()
-    except buildtools.BuildError, detail:
+    except buildtools.BuildError as detail:
         EasyDialogs.Message(detail)
 
 

Modified: python/branches/p3yk/Mac/scripts/buildpkg.py
==============================================================================
--- python/branches/p3yk/Mac/scripts/buildpkg.py	(original)
+++ python/branches/p3yk/Mac/scripts/buildpkg.py	Wed Jan 10 17:19:56 2007
@@ -451,7 +451,7 @@
 
     try:
         opts, args = getopt.getopt(sys.argv[1:], shortOpts, longOpts)
-    except getopt.GetoptError, details:
+    except getopt.GetoptError as details:
         print details
         printUsage()
         return

Modified: python/branches/p3yk/Misc/BeOS-setup.py
==============================================================================
--- python/branches/p3yk/Misc/BeOS-setup.py	(original)
+++ python/branches/p3yk/Misc/BeOS-setup.py	Wed Jan 10 17:19:56 2007
@@ -127,7 +127,7 @@
 
         try:
             build_ext.build_extension(self, ext)
-        except (CCompilerError, DistutilsError), why:
+        except (CCompilerError, DistutilsError) as why:
             self.announce('WARNING: building of extension "%s" failed: %s' %
                           (ext.name, sys.exc_info()[1]))
 

Modified: python/branches/p3yk/Modules/parsermodule.c
==============================================================================
--- python/branches/p3yk/Modules/parsermodule.c	(original)
+++ python/branches/p3yk/Modules/parsermodule.c	Wed Jan 10 17:19:56 2007
@@ -2110,8 +2110,8 @@
     if (res && (nch > 1))
         res = validate_test(CHILD(tree, 1));
     if (res && (nch == 4))
-        res = (validate_comma(CHILD(tree, 2))
-               && validate_test(CHILD(tree, 3)));
+        res = (validate_name(CHILD(tree, 2), "as")
+               && validate_ntype(CHILD(tree, 3), NAME));
 
     return (res);
 }

Modified: python/branches/p3yk/Python/compile.c
==============================================================================
--- python/branches/p3yk/Python/compile.c	(original)
+++ python/branches/p3yk/Python/compile.c	Wed Jan 10 17:19:56 2007
@@ -1955,13 +1955,66 @@
 		}
 		ADDOP(c, POP_TOP);
 		if (handler->name) {
+            basicblock *cleanup_end, *cleanup_body;
+            expr_context_ty orig_ctx;
+            
+            assert(handler->name->kind == Name_kind);
+
+            cleanup_end = compiler_new_block(c);
+            cleanup_body = compiler_new_block(c);
+            if(!(cleanup_end || cleanup_body))
+                return 0;
+
 			VISIT(c, expr, handler->name);
+            ADDOP(c, POP_TOP);
+
+            /*
+                try:
+                    # body
+                except type as name:
+                    try:
+                        # body
+                    finally:
+                        name = None
+                        del name
+            */
+
+            /* second try: */
+            ADDOP_JREL(c, SETUP_FINALLY, cleanup_end);
+	        compiler_use_next_block(c, cleanup_body);
+	        if (!compiler_push_fblock(c, FINALLY_TRY, cleanup_body))
+		        return 0;
+
+            /* second # body */
+	        VISIT_SEQ(c, stmt, handler->body);
+	        ADDOP(c, POP_BLOCK);
+	        compiler_pop_fblock(c, FINALLY_TRY, cleanup_body);
+
+            /* finally: */
+	        ADDOP_O(c, LOAD_CONST, Py_None, consts);
+	        compiler_use_next_block(c, cleanup_end);
+	        if (!compiler_push_fblock(c, FINALLY_END, cleanup_end))
+		        return 0;
+
+            /* name = None */
+            ADDOP_O(c, LOAD_CONST, Py_None, consts);
+            orig_ctx = handler->name->v.Name.ctx;
+            handler->name->v.Name.ctx = Store;
+            VISIT(c, expr, handler->name);
+
+            /* del name */            
+            handler->name->v.Name.ctx = Del;
+            VISIT(c, expr, handler->name);
+            handler->name->v.Name.ctx = orig_ctx;
+
+	        ADDOP(c, END_FINALLY);
+	        compiler_pop_fblock(c, FINALLY_END, cleanup_end);
 		}
 		else {
-			ADDOP(c, POP_TOP);
+            ADDOP(c, POP_TOP);
+            ADDOP(c, POP_TOP);
+		    VISIT_SEQ(c, stmt, handler->body);
 		}
-		ADDOP(c, POP_TOP);
-		VISIT_SEQ(c, stmt, handler->body);
 		ADDOP_JREL(c, JUMP_FORWARD, end);
 		compiler_use_next_block(c, except);
 		if (handler->type)

Modified: python/branches/p3yk/Python/graminit.c
==============================================================================
--- python/branches/p3yk/Python/graminit.c	(original)
+++ python/branches/p3yk/Python/graminit.c	Wed Jan 10 17:19:56 2007
@@ -1049,7 +1049,7 @@
 	{0, 1},
 };
 static arc arcs_46_2[2] = {
-	{28, 3},
+	{83, 3},
 	{0, 2},
 };
 static arc arcs_46_3[1] = {

Modified: python/branches/p3yk/Tools/audiopy/audiopy
==============================================================================
--- python/branches/p3yk/Tools/audiopy/audiopy	(original)
+++ python/branches/p3yk/Tools/audiopy/audiopy	Wed Jan 10 17:19:56 2007
@@ -309,7 +309,7 @@
         info.o_gain = self.__scalevar.get()
         try:
             self.__devctl.setinfo(info)
-        except sunaudiodev.error, msg:
+        except sunaudiodev.error as msg:
             # TBD: what to do?  it's probably temporary.
             pass
 
@@ -496,7 +496,8 @@
     # now set the values
     try:
         device.setinfo(info)
-    except sunaudiodev.error, (code, msg):
+    except sunaudiodev.error as e:
+        (code, msg) = e
         if code <> errno.EINVAL:
             raise
     device.close()

Modified: python/branches/p3yk/Tools/bgen/bgen/scantools.py
==============================================================================
--- python/branches/p3yk/Tools/bgen/bgen/scantools.py	(original)
+++ python/branches/p3yk/Tools/bgen/bgen/scantools.py	Wed Jan 10 17:19:56 2007
@@ -293,7 +293,7 @@
     def openrepairfile(self, filename = "REPAIR"):
         try:
             return open(filename, "rU")
-        except IOError, msg:
+        except IOError as msg:
             print repr(filename), ":", msg
             print "Cannot open repair file -- assume no repair needed"
             return None
@@ -419,7 +419,7 @@
     def openoutput(self, filename):
         try:
             file = open(filename, 'w')
-        except IOError, arg:
+        except IOError as arg:
             raise IOError, (filename, arg)
         self.setfiletype(filename)
         return file
@@ -460,7 +460,7 @@
         # If not on the path, or absolute, try default open()
         try:
             return open(filename, 'rU')
-        except IOError, arg:
+        except IOError as arg:
             raise IOError, (arg, filename)
 
     def getline(self):

Modified: python/branches/p3yk/Tools/compiler/compile.py
==============================================================================
--- python/branches/p3yk/Tools/compiler/compile.py	(original)
+++ python/branches/p3yk/Tools/compiler/compile.py	Wed Jan 10 17:19:56 2007
@@ -40,7 +40,7 @@
                 else:
                     compileFile(filename, DISPLAY)
 
-            except SyntaxError, err:
+            except SyntaxError as err:
                 print err
                 if err.lineno is not None:
                     print err.lineno

Modified: python/branches/p3yk/Tools/compiler/regrtest.py
==============================================================================
--- python/branches/p3yk/Tools/compiler/regrtest.py	(original)
+++ python/branches/p3yk/Tools/compiler/regrtest.py	Wed Jan 10 17:19:56 2007
@@ -42,7 +42,7 @@
             print file,
             try:
                 compileFile(source)
-            except SyntaxError, err:
+            except SyntaxError as err:
                 print err
                 continue
             # make sure the .pyc file is not over-written

Modified: python/branches/p3yk/Tools/faqwiz/faqw.py
==============================================================================
--- python/branches/p3yk/Tools/faqwiz/faqw.py	(original)
+++ python/branches/p3yk/Tools/faqwiz/faqw.py	Wed Jan 10 17:19:56 2007
@@ -24,7 +24,7 @@
     os.chdir(FAQDIR)
     sys.path.insert(0, SRCDIR)
     import faqwiz
-except SystemExit, n:
+except SystemExit as n:
     sys.exit(n)
 except:
     t, v, tb = sys.exc_info()

Modified: python/branches/p3yk/Tools/faqwiz/faqwiz.py
==============================================================================
--- python/branches/p3yk/Tools/faqwiz/faqwiz.py	(original)
+++ python/branches/p3yk/Tools/faqwiz/faqwiz.py	Wed Jan 10 17:19:56 2007
@@ -348,7 +348,7 @@
             raise InvalidFile(file)
         try:
             fp = open(file)
-        except IOError, msg:
+        except IOError as msg:
             raise NoSuchFile(file, msg)
         try:
             return self.entryclass(fp, file, sec_num)
@@ -387,11 +387,11 @@
         else:
             try:
                 meth()
-            except InvalidFile, exc:
+            except InvalidFile as exc:
                 self.error("Invalid entry file name %s" % exc.file)
-            except NoSuchFile, exc:
+            except NoSuchFile as exc:
                 self.error("No entry with file name %s" % exc.file)
-            except NoSuchSection, exc:
+            except NoSuchSection as exc:
                 self.error("No section number %s" % exc.section)
         self.epilogue()
 
@@ -796,7 +796,7 @@
             pass
         try:
             f = open(file, 'w')
-        except IOError, why:
+        except IOError as why:
             self.error(CANTWRITE, file=file, why=why)
             return
         date = time.ctime(now)

Modified: python/branches/p3yk/Tools/freeze/checkextensions_win32.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/checkextensions_win32.py	(original)
+++ python/branches/p3yk/Tools/freeze/checkextensions_win32.py	Wed Jan 10 17:19:56 2007
@@ -131,7 +131,7 @@
     dsp_path, dsp_name = os.path.split(dsp)
     try:
         lines = open(dsp, "r").readlines()
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write("%s: %s\n" % (dsp, msg))
         return None
     for line in lines:

Modified: python/branches/p3yk/Tools/freeze/freeze.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/freeze.py	(original)
+++ python/branches/p3yk/Tools/freeze/freeze.py	Wed Jan 10 17:19:56 2007
@@ -145,7 +145,7 @@
         if sys.argv[pos] == '-i':
             try:
                 options = open(sys.argv[pos+1]).read().split()
-            except IOError, why:
+            except IOError as why:
                 usage("File name '%s' specified with the -i option "
                       "can not be read - %s" % (sys.argv[pos+1], why) )
             # Replace the '-i' and the filename with the read params.
@@ -156,7 +156,7 @@
     # Now parse the command line with the extras inserted.
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'r:a:dEe:hmo:p:P:qs:wX:x:l:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage('getopt error: ' + str(msg))
 
     # proces option arguments
@@ -311,7 +311,7 @@
         try:
             os.mkdir(odir)
             print "Created output directory", odir
-        except os.error, msg:
+        except os.error as msg:
             usage('%s: mkdir failed (%s)' % (odir, str(msg)))
     base = ''
     if odir:
@@ -333,7 +333,7 @@
         try:
             custom_entry_point, python_entry_is_main = \
                 winmakemakefile.get_custom_entry_point(subsystem)
-        except ValueError, why:
+        except ValueError as why:
             usage(why)
 
 

Modified: python/branches/p3yk/Tools/i18n/msgfmt.py
==============================================================================
--- python/branches/p3yk/Tools/i18n/msgfmt.py	(original)
+++ python/branches/p3yk/Tools/i18n/msgfmt.py	Wed Jan 10 17:19:56 2007
@@ -110,7 +110,7 @@
 
     try:
         lines = open(infile).readlines()
-    except IOError, msg:
+    except IOError as msg:
         print >> sys.stderr, msg
         sys.exit(1)
 
@@ -167,7 +167,7 @@
 
     try:
         open(outfile,"wb").write(output)
-    except IOError,msg:
+    except IOError as msg:
         print >> sys.stderr, msg
 
 
@@ -176,7 +176,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'hVo:',
                                    ['help', 'version', 'output-file='])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(1, msg)
 
     outfile = None

Modified: python/branches/p3yk/Tools/i18n/pygettext.py
==============================================================================
--- python/branches/p3yk/Tools/i18n/pygettext.py	(original)
+++ python/branches/p3yk/Tools/i18n/pygettext.py	Wed Jan 10 17:19:56 2007
@@ -512,7 +512,7 @@
              'style=', 'verbose', 'version', 'width=', 'exclude-file=',
              'docstrings', 'no-docstrings',
              ])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(1, msg)
 
     # for holding option values
@@ -635,7 +635,7 @@
             eater.set_filename(filename)
             try:
                 tokenize.tokenize(fp.readline, eater)
-            except tokenize.TokenError, e:
+            except tokenize.TokenError as e:
                 print >> sys.stderr, '%s: %s, line %d, column %d' % (
                     e[0], filename, e[1][0], e[1][1])
         finally:

Modified: python/branches/p3yk/Tools/pybench/CommandLine.py
==============================================================================
--- python/branches/p3yk/Tools/pybench/CommandLine.py	(original)
+++ python/branches/p3yk/Tools/pybench/CommandLine.py	Wed Jan 10 17:19:56 2007
@@ -347,7 +347,7 @@
             if rc is None:
                 rc = 0
 
-        except SystemExit,rc:
+        except SystemExit as rc:
             pass
 
         except KeyboardInterrupt:
@@ -433,7 +433,7 @@
                 files = l
             self.optionlist = optlist
             self.files = files + self.files
-        except getopt.error,why:
+        except getopt.error as why:
             self.help(why)
             sys.exit(1)
 

Modified: python/branches/p3yk/Tools/pybench/pybench.py
==============================================================================
--- python/branches/p3yk/Tools/pybench/pybench.py	(original)
+++ python/branches/p3yk/Tools/pybench/pybench.py	Wed Jan 10 17:19:56 2007
@@ -865,7 +865,7 @@
                 bench.name = compare_to
                 f.close()
                 compare_to = bench
-            except IOError, reason:
+            except IOError as reason:
                 print '* Error opening/reading file %s: %s' % (
                     repr(compare_to),
                     reason)
@@ -885,7 +885,7 @@
                 else:
                     bench.print_benchmark(hidenoise=hidenoise,
                                           limitnames=limitnames)
-            except IOError, reason:
+            except IOError as reason:
                 print '* Error opening/reading file %s: %s' % (
                     repr(show_bench),
                     reason)
@@ -931,9 +931,9 @@
                 bench.name = reportfile
                 pickle.dump(bench,f)
                 f.close()
-            except IOError, reason:
+            except IOError as reason:
                 print '* Error opening/writing reportfile'
-            except IOError, reason:
+            except IOError as reason:
                 print '* Error opening/writing reportfile %s: %s' % (
                     reportfile,
                     reason)

Modified: python/branches/p3yk/Tools/pynche/Main.py
==============================================================================
--- python/branches/p3yk/Tools/pynche/Main.py	(original)
+++ python/branches/p3yk/Tools/pynche/Main.py	Wed Jan 10 17:19:56 2007
@@ -186,7 +186,7 @@
             sys.argv[1:],
             'hd:i:Xv',
             ['database=', 'initfile=', 'ignore', 'help', 'version'])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(1, msg)
 
     if len(args) == 0:

Modified: python/branches/p3yk/Tools/scripts/byext.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/byext.py	(original)
+++ python/branches/p3yk/Tools/scripts/byext.py	Wed Jan 10 17:19:56 2007
@@ -24,7 +24,7 @@
         self.addstats("<dir>", "dirs", 1)
         try:
             names = os.listdir(dir)
-        except os.error, err:
+        except os.error as err:
             sys.stderr.write("Can't list %s: %s\n" % (dir, err))
             self.addstats("<dir>", "unlistable", 1)
             return
@@ -53,7 +53,7 @@
         self.addstats(ext, "files", 1)
         try:
             f = open(filename, "rb")
-        except IOError, err:
+        except IOError as err:
             sys.stderr.write("Can't open %s: %s\n" % (filename, err))
             self.addstats(ext, "unopenable", 1)
             return

Modified: python/branches/p3yk/Tools/scripts/byteyears.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/byteyears.py	(original)
+++ python/branches/p3yk/Tools/scripts/byteyears.py	Wed Jan 10 17:19:56 2007
@@ -43,7 +43,7 @@
     for filename in sys.argv[1:]:
         try:
             st = statfunc(filename)
-        except os.error, msg:
+        except os.error as msg:
             sys.stderr.write("can't stat %r: %r\n" % (filename, msg))
             status = 1
             st = ()

Modified: python/branches/p3yk/Tools/scripts/checkappend.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/checkappend.py	(original)
+++ python/branches/p3yk/Tools/scripts/checkappend.py	Wed Jan 10 17:19:56 2007
@@ -50,7 +50,7 @@
     global verbose
     try:
         opts, args = getopt.getopt(sys.argv[1:], "v")
-    except getopt.error, msg:
+    except getopt.error as msg:
         errprint(str(msg) + "\n\n" + __doc__)
         return
     for opt, optarg in opts:
@@ -77,7 +77,7 @@
 
     try:
         f = open(file)
-    except IOError, msg:
+    except IOError as msg:
         errprint("%r: I/O Error: %s" % (file, msg))
         return
 
@@ -104,7 +104,7 @@
     def run(self):
         try:
             tokenize.tokenize(self.file.readline, self.tokeneater)
-        except tokenize.TokenError, msg:
+        except tokenize.TokenError as msg:
             errprint("%r: Token Error: %s" % (self.fname, msg))
             self.nerrors = self.nerrors + 1
         return self.nerrors == 0

Modified: python/branches/p3yk/Tools/scripts/classfix.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/classfix.py	(original)
+++ python/branches/p3yk/Tools/scripts/classfix.py	Wed Jan 10 17:19:56 2007
@@ -62,7 +62,7 @@
     bad = 0
     try:
         names = os.listdir(dirname)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: cannot list directory: %r\n' % (dirname, msg))
         return 1
     names.sort()
@@ -83,7 +83,7 @@
 ##  dbg('fix(%r)\n' % (filename,))
     try:
         f = open(filename, 'r')
-    except IOError, msg:
+    except IOError as msg:
         err('%s: cannot open: %r\n' % (filename, msg))
         return 1
     head, tail = os.path.split(filename)
@@ -106,7 +106,7 @@
             if g is None:
                 try:
                     g = open(tempname, 'w')
-                except IOError, msg:
+                except IOError as msg:
                     f.close()
                     err('%s: cannot create: %r\n' % (tempname, msg))
                     return 1
@@ -130,17 +130,17 @@
     try:
         statbuf = os.stat(filename)
         os.chmod(tempname, statbuf[ST_MODE] & 07777)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
     # Then make a backup of the original file as filename~
     try:
         os.rename(filename, filename + '~')
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: backup failed (%r)\n' % (filename, msg))
     # Now move the temp file to the original file
     try:
         os.rename(tempname, filename)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: rename failed (%r)\n' % (filename, msg))
         return 1
     # Return succes

Modified: python/branches/p3yk/Tools/scripts/cleanfuture.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/cleanfuture.py	(original)
+++ python/branches/p3yk/Tools/scripts/cleanfuture.py	Wed Jan 10 17:19:56 2007
@@ -59,7 +59,7 @@
     global verbose, recurse, dryrun
     try:
         opts, args = getopt.getopt(sys.argv[1:], "drv")
-    except getopt.error, msg:
+    except getopt.error as msg:
         errprint(msg)
         return
     for o, a in opts:
@@ -92,7 +92,7 @@
         print "checking", file, "...",
     try:
         f = open(file)
-    except IOError, msg:
+    except IOError as msg:
         errprint("%r: I/O Error: %s" % (file, str(msg)))
         return
 

Modified: python/branches/p3yk/Tools/scripts/cvsfiles.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/cvsfiles.py	(original)
+++ python/branches/p3yk/Tools/scripts/cvsfiles.py	Wed Jan 10 17:19:56 2007
@@ -20,7 +20,7 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], "n:")
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print __doc__,
         return 1

Modified: python/branches/p3yk/Tools/scripts/dutree.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/dutree.py	(original)
+++ python/branches/p3yk/Tools/scripts/dutree.py	Wed Jan 10 17:19:56 2007
@@ -18,7 +18,7 @@
         total, d = store(size, comps, total, d)
     try:
         display(total, d)
-    except IOError, e:
+    except IOError as e:
         if e.errno != errno.EPIPE:
             raise
 

Modified: python/branches/p3yk/Tools/scripts/finddiv.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/finddiv.py	(original)
+++ python/branches/p3yk/Tools/scripts/finddiv.py	Wed Jan 10 17:19:56 2007
@@ -23,7 +23,7 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], "lh")
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(msg)
         return 2
     if not args:
@@ -52,7 +52,7 @@
         return processdir(filename, listnames)
     try:
         fp = open(filename)
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write("Can't open: %s\n" % msg)
         return 1
     g = tokenize.generate_tokens(fp.readline)
@@ -70,7 +70,7 @@
 def processdir(dir, listnames):
     try:
         names = os.listdir(dir)
-    except os.error, msg:
+    except os.error as msg:
         sys.stderr.write("Can't list directory: %s\n" % dir)
         return 1
     files = []

Modified: python/branches/p3yk/Tools/scripts/findlinksto.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/findlinksto.py	(original)
+++ python/branches/p3yk/Tools/scripts/findlinksto.py	Wed Jan 10 17:19:56 2007
@@ -14,7 +14,7 @@
         opts, args = getopt.getopt(sys.argv[1:], '')
         if len(args) < 2:
             raise getopt.GetoptError('not enough arguments', None)
-    except getopt.GetoptError, msg:
+    except getopt.GetoptError as msg:
         sys.stdout = sys.stderr
         print msg
         print 'usage: findlinksto pattern directory ...'

Modified: python/branches/p3yk/Tools/scripts/findnocoding.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/findnocoding.py	(original)
+++ python/branches/p3yk/Tools/scripts/findnocoding.py	Wed Jan 10 17:19:56 2007
@@ -78,7 +78,7 @@
 
 try:
     opts, args = getopt.getopt(sys.argv[1:], 'cd')
-except getopt.error, msg:
+except getopt.error as msg:
     print >>sys.stderr, msg
     print >>sys.stderr, usage
     sys.exit(1)

Modified: python/branches/p3yk/Tools/scripts/fixcid.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/fixcid.py	(original)
+++ python/branches/p3yk/Tools/scripts/fixcid.py	Wed Jan 10 17:19:56 2007
@@ -62,7 +62,7 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'crs:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         err('Options error: ' + str(msg) + '\n')
         usage()
         sys.exit(2)
@@ -97,7 +97,7 @@
     bad = 0
     try:
         names = os.listdir(dirname)
-    except os.error, msg:
+    except os.error as msg:
         err(dirname + ': cannot list directory: ' + str(msg) + '\n')
         return 1
     names.sort()
@@ -124,7 +124,7 @@
         # File replacement mode
         try:
             f = open(filename, 'r')
-        except IOError, msg:
+        except IOError as msg:
             err(filename + ': cannot open: ' + str(msg) + '\n')
             return 1
         head, tail = os.path.split(filename)
@@ -148,7 +148,7 @@
             if g is None:
                 try:
                     g = open(tempname, 'w')
-                except IOError, msg:
+                except IOError as msg:
                     f.close()
                     err(tempname+': cannot create: '+
                         str(msg)+'\n')
@@ -175,17 +175,17 @@
     try:
         statbuf = os.stat(filename)
         os.chmod(tempname, statbuf[ST_MODE] & 07777)
-    except os.error, msg:
+    except os.error as msg:
         err(tempname + ': warning: chmod failed (' + str(msg) + ')\n')
     # Then make a backup of the original file as filename~
     try:
         os.rename(filename, filename + '~')
-    except os.error, msg:
+    except os.error as msg:
         err(filename + ': warning: backup failed (' + str(msg) + ')\n')
     # Now move the temp file to the original file
     try:
         os.rename(tempname, filename)
-    except os.error, msg:
+    except os.error as msg:
         err(filename + ': rename failed (' + str(msg) + ')\n')
         return 1
     # Return succes
@@ -276,7 +276,7 @@
 def addsubst(substfile):
     try:
         fp = open(substfile, 'r')
-    except IOError, msg:
+    except IOError as msg:
         err(substfile + ': cannot read substfile: ' + str(msg) + '\n')
         sys.exit(1)
     lineno = 0

Modified: python/branches/p3yk/Tools/scripts/fixdiv.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/fixdiv.py	(original)
+++ python/branches/p3yk/Tools/scripts/fixdiv.py	Wed Jan 10 17:19:56 2007
@@ -140,7 +140,7 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], "hm")
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(msg)
         return 2
     for o, a in opts:
@@ -181,7 +181,7 @@
     prog = re.compile(PATTERN)
     try:
         f = open(warningsfile)
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write("can't open: %s\n" % msg)
         return
     warnings = {}
@@ -207,7 +207,7 @@
     assert list # if this fails, readwarnings() is broken
     try:
         fp = open(filename)
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write("can't open: %s\n" % msg)
         return 1
     print "Index:", filename

Modified: python/branches/p3yk/Tools/scripts/fixheader.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/fixheader.py	(original)
+++ python/branches/p3yk/Tools/scripts/fixheader.py	Wed Jan 10 17:19:56 2007
@@ -12,7 +12,7 @@
 def process(filename):
     try:
         f = open(filename, 'r')
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write('%s: can\'t open: %s\n' % (filename, str(msg)))
         return
     data = f.read()
@@ -22,7 +22,7 @@
         return
     try:
         f = open(filename, 'w')
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write('%s: can\'t write: %s\n' % (filename, str(msg)))
         return
     sys.stderr.write('Processing %s ...\n' % filename)

Modified: python/branches/p3yk/Tools/scripts/fixnotice.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/fixnotice.py	(original)
+++ python/branches/p3yk/Tools/scripts/fixnotice.py	Wed Jan 10 17:19:56 2007
@@ -62,7 +62,7 @@
         opts, args = getopt.getopt(sys.argv[1:], 'hv',
                                    ['help', 'oldnotice=', 'newnotice=',
                                     'dry-run', 'verbose'])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(1, msg)
 
     for opt, arg in opts:

Modified: python/branches/p3yk/Tools/scripts/fixps.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/fixps.py	(original)
+++ python/branches/p3yk/Tools/scripts/fixps.py	Wed Jan 10 17:19:56 2007
@@ -11,7 +11,7 @@
     for filename in sys.argv[1:]:
         try:
             f = open(filename, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print filename, ': can\'t open :', msg
             continue
         line = f.readline()

Modified: python/branches/p3yk/Tools/scripts/ftpmirror.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/ftpmirror.py	(original)
+++ python/branches/p3yk/Tools/scripts/ftpmirror.py	Wed Jan 10 17:19:56 2007
@@ -45,7 +45,7 @@
     global verbose, interactive, mac, rmok, nologin
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'a:bil:mnp:qrs:v')
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(msg)
     login = ''
     passwd = ''
@@ -108,13 +108,13 @@
         if verbose: print 'Creating local directory', repr(localdir)
         try:
             makedir(localdir)
-        except os.error, msg:
+        except os.error as msg:
             print "Failed to establish local directory", repr(localdir)
             return
     infofilename = os.path.join(localdir, '.mirrorinfo')
     try:
         text = open(infofilename, 'r').read()
-    except IOError, msg:
+    except IOError as msg:
         text = '{}'
     try:
         info = eval(text)
@@ -190,13 +190,13 @@
                 print "Creating symlink %r -> %r" % (filename, linkto)
             try:
                 os.symlink(linkto, tempname)
-            except IOError, msg:
+            except IOError as msg:
                 print "Can't create %r: %s" % (tempname, msg)
                 continue
         else:
             try:
                 fp = open(tempname, 'wb')
-            except IOError, msg:
+            except IOError as msg:
                 print "Can't create %r: %s" % (tempname, msg)
                 continue
             if verbose:
@@ -209,7 +209,7 @@
             try:
                 f.retrbinary('RETR ' + filename,
                              fp1.write, 8*1024)
-            except ftplib.error_perm, msg:
+            except ftplib.error_perm as msg:
                 print msg
             t1 = time.time()
             bytes = fp.tell()
@@ -222,7 +222,7 @@
             pass            # Ignore the error
         try:
             os.rename(tempname, fullname)
-        except os.error, msg:
+        except os.error as msg:
             print "Can't rename %r to %r: %s" % (tempname, fullname, msg)
             continue
         info[filename] = infostuff
@@ -292,7 +292,7 @@
             print 'Remote cwd', repr(subdir)
         try:
             f.cwd(subdir)
-        except ftplib.error_perm, msg:
+        except ftplib.error_perm as msg:
             print "Can't chdir to", repr(subdir), ":", repr(msg)
         else:
             if verbose: print 'Mirroring as', repr(localsubdir)
@@ -322,13 +322,13 @@
             return 0
         try:
             os.rmdir(fullname)
-        except os.error, msg:
+        except os.error as msg:
             print "Can't remove local directory %r: %s" % (fullname, msg)
             return 0
     else:
         try:
             os.unlink(fullname)
-        except os.error, msg:
+        except os.error as msg:
             print "Can't remove local file %r: %s" % (fullname, msg)
             return 0
     return 1

Modified: python/branches/p3yk/Tools/scripts/linktree.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/linktree.py	(original)
+++ python/branches/p3yk/Tools/scripts/linktree.py	Wed Jan 10 17:19:56 2007
@@ -32,13 +32,13 @@
         return 1
     try:
         os.mkdir(newtree, 0777)
-    except os.error, msg:
+    except os.error as msg:
         print newtree + ': cannot mkdir:', msg
         return 1
     linkname = os.path.join(newtree, link)
     try:
         os.symlink(os.path.join(os.pardir, oldtree), linkname)
-    except os.error, msg:
+    except os.error as msg:
         if not link_may_fail:
             print linkname + ': cannot symlink:', msg
             return 1
@@ -51,7 +51,7 @@
     if debug: print 'linknames', (old, new, link)
     try:
         names = os.listdir(old)
-    except os.error, msg:
+    except os.error as msg:
         print old + ': warning: cannot listdir:', msg
         return
     for name in names:

Modified: python/branches/p3yk/Tools/scripts/logmerge.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/logmerge.py	(original)
+++ python/branches/p3yk/Tools/scripts/logmerge.py	Wed Jan 10 17:19:56 2007
@@ -180,6 +180,6 @@
 if __name__ == '__main__':
     try:
         main()
-    except IOError, e:
+    except IOError as e:
         if e.errno != errno.EPIPE:
             raise

Modified: python/branches/p3yk/Tools/scripts/md5sum.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/md5sum.py	(original)
+++ python/branches/p3yk/Tools/scripts/md5sum.py	Wed Jan 10 17:19:56 2007
@@ -43,7 +43,7 @@
 def printsum(filename, out=sys.stdout):
     try:
         fp = open(filename, rmode)
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
         return 1
     if fnfilter:
@@ -60,7 +60,7 @@
             if not data:
                 break
             m.update(data)
-    except IOError, msg:
+    except IOError as msg:
         sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
         return 1
     out.write('%s %s\n' % (m.hexdigest(), filename))
@@ -70,7 +70,7 @@
     global fnfilter, rmode, bufsize
     try:
         opts, args = getopt.getopt(args, 'blts:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage))
         return 2
     for o, a in opts:

Modified: python/branches/p3yk/Tools/scripts/methfix.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/methfix.py	(original)
+++ python/branches/p3yk/Tools/scripts/methfix.py	Wed Jan 10 17:19:56 2007
@@ -59,7 +59,7 @@
     bad = 0
     try:
         names = os.listdir(dirname)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: cannot list directory: %r\n' % (dirname, msg))
         return 1
     names.sort()
@@ -80,7 +80,7 @@
 ##  dbg('fix(%r)\n' % (filename,))
     try:
         f = open(filename, 'r')
-    except IOError, msg:
+    except IOError as msg:
         err('%s: cannot open: %r\n' % (filename, msg))
         return 1
     head, tail = os.path.split(filename)
@@ -117,7 +117,7 @@
             if g is None:
                 try:
                     g = open(tempname, 'w')
-                except IOError, msg:
+                except IOError as msg:
                     f.close()
                     err('%s: cannot create: %r\n' % (tempname, msg))
                     return 1
@@ -141,17 +141,17 @@
     try:
         statbuf = os.stat(filename)
         os.chmod(tempname, statbuf[ST_MODE] & 07777)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
     # Then make a backup of the original file as filename~
     try:
         os.rename(filename, filename + '~')
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: backup failed (%r)\n' % (filename, msg))
     # Now move the temp file to the original file
     try:
         os.rename(tempname, filename)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: rename failed (%r)\n' % (filename, msg))
         return 1
     # Return succes

Modified: python/branches/p3yk/Tools/scripts/ndiff.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/ndiff.py	(original)
+++ python/branches/p3yk/Tools/scripts/ndiff.py	Wed Jan 10 17:19:56 2007
@@ -61,7 +61,7 @@
 def fopen(fname):
     try:
         return open(fname, 'U')
-    except IOError, detail:
+    except IOError as detail:
         return fail("couldn't open " + fname + ": " + str(detail))
 
 # open two files & spray the diff to stdout; return false iff a problem
@@ -85,7 +85,7 @@
     import getopt
     try:
         opts, args = getopt.getopt(args, "qr:")
-    except getopt.error, detail:
+    except getopt.error as detail:
         return fail(str(detail))
     noisy = 1
     qseen = rseen = 0

Modified: python/branches/p3yk/Tools/scripts/pathfix.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/pathfix.py	(original)
+++ python/branches/p3yk/Tools/scripts/pathfix.py	Wed Jan 10 17:19:56 2007
@@ -37,7 +37,7 @@
              sys.argv[0])
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'i:')
-    except getopt.error, msg:
+    except getopt.error as msg:
         err(msg + '\n')
         err(usage)
         sys.exit(2)
@@ -68,7 +68,7 @@
     bad = 0
     try:
         names = os.listdir(dirname)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: cannot list directory: %r\n' % (dirname, msg))
         return 1
     names.sort()
@@ -89,7 +89,7 @@
 ##  dbg('fix(%r)\n' % (filename,))
     try:
         f = open(filename, 'r')
-    except IOError, msg:
+    except IOError as msg:
         err('%s: cannot open: %r\n' % (filename, msg))
         return 1
     line = f.readline()
@@ -102,7 +102,7 @@
     tempname = os.path.join(head, '@' + tail)
     try:
         g = open(tempname, 'w')
-    except IOError, msg:
+    except IOError as msg:
         f.close()
         err('%s: cannot create: %r\n' % (tempname, msg))
         return 1
@@ -122,17 +122,17 @@
     try:
         statbuf = os.stat(filename)
         os.chmod(tempname, statbuf[ST_MODE] & 07777)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
     # Then make a backup of the original file as filename~
     try:
         os.rename(filename, filename + '~')
-    except os.error, msg:
+    except os.error as msg:
         err('%s: warning: backup failed (%r)\n' % (filename, msg))
     # Now move the temp file to the original file
     try:
         os.rename(tempname, filename)
-    except os.error, msg:
+    except os.error as msg:
         err('%s: rename failed (%r)\n' % (filename, msg))
         return 1
     # Return succes

Modified: python/branches/p3yk/Tools/scripts/pindent.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/pindent.py	(original)
+++ python/branches/p3yk/Tools/scripts/pindent.py	Wed Jan 10 17:19:56 2007
@@ -491,7 +491,7 @@
     import getopt
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'cdrs:t:e')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stderr.write('Error: %s\n' % msg)
         sys.stderr.write(usage)
         sys.exit(2)

Modified: python/branches/p3yk/Tools/scripts/pysource.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/pysource.py	(original)
+++ python/branches/p3yk/Tools/scripts/pysource.py	Wed Jan 10 17:19:56 2007
@@ -33,7 +33,7 @@
 def _open(fullpath):
     try:
         size = os.stat(fullpath).st_size
-    except OSError, err: # Permission denied - ignore the file
+    except OSError as err: # Permission denied - ignore the file
         print_debug("%s: permission denied: %s" % (fullpath, err))
         return None
 
@@ -43,7 +43,7 @@
 
     try:
         return open(fullpath, 'rU')
-    except IOError, err: # Access denied, or a special file - ignore it
+    except IOError as err: # Access denied, or a special file - ignore it
         print_debug("%s: access denied: %s" % (fullpath, err))
         return None
 
@@ -81,7 +81,7 @@
 
     try:
         compile(code, fullpath, "exec")
-    except Exception, err:
+    except Exception as err:
         print_debug("%s: cannot compile: %s" % (fullpath, err))
         return False
 

Modified: python/branches/p3yk/Tools/scripts/redemo.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/redemo.py	(original)
+++ python/branches/p3yk/Tools/scripts/redemo.py	Wed Jan 10 17:19:56 2007
@@ -104,7 +104,7 @@
                                        self.getflags())
             bg = self.promptdisplay['background']
             self.statusdisplay.config(text="", background=bg)
-        except re.error, msg:
+        except re.error as msg:
             self.compiled = None
             self.statusdisplay.config(
                     text="re.error: %s" % str(msg),

Modified: python/branches/p3yk/Tools/scripts/reindent.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/reindent.py	(original)
+++ python/branches/p3yk/Tools/scripts/reindent.py	Wed Jan 10 17:19:56 2007
@@ -61,7 +61,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], "drvh",
                                    ["dryrun", "recurse", "verbose", "help"])
-    except getopt.error, msg:
+    except getopt.error as msg:
         usage(msg)
         return
     for o, a in opts:
@@ -99,7 +99,7 @@
         print "checking", file, "...",
     try:
         f = open(file)
-    except IOError, msg:
+    except IOError as msg:
         errprint("%s: I/O Error: %s" % (file, str(msg)))
         return
 

Modified: python/branches/p3yk/Tools/scripts/rgrep.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/rgrep.py	(original)
+++ python/branches/p3yk/Tools/scripts/rgrep.py	Wed Jan 10 17:19:56 2007
@@ -23,11 +23,11 @@
     pattern, filename = args
     try:
         prog = re.compile(pattern, reflags)
-    except re.error, msg:
+    except re.error as msg:
         usage("error in regular expression: %s" % str(msg))
     try:
         f = open(filename)
-    except IOError, msg:
+    except IOError as msg:
         usage("can't open %s: %s" % (repr(filename), str(msg)), 1)
     f.seek(0, 2)
     pos = f.tell()

Modified: python/branches/p3yk/Tools/scripts/texi2html.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/texi2html.py	(original)
+++ python/branches/p3yk/Tools/scripts/texi2html.py	Wed Jan 10 17:19:56 2007
@@ -554,7 +554,7 @@
         file = os.path.join(self.includedir, file)
         try:
             fp = open(file, 'r')
-        except IOError, msg:
+        except IOError as msg:
             print '*** Can\'t open include file', repr(file)
             return
         print '!'*self.debugging, '--> file', repr(file)
@@ -1797,7 +1797,7 @@
             print>>fp, ''
             self.dumpfiles(fp)
             fp.close()
-        except IOError, msg:
+        except IOError as msg:
             print projectfile, ':', msg
             sys.exit(1)
 
@@ -1822,7 +1822,7 @@
             print>>fp, '</BODY>'
             print>>fp, '</HTML>'
             fp.close()
-        except IOError, msg:
+        except IOError as msg:
             print contentfile, ':', msg
             sys.exit(1)
 
@@ -1844,7 +1844,7 @@
             print>>fp, '</BODY>'
             print>>fp, '</HTML>'
             fp.close()
-        except IOError, msg:
+        except IOError as msg:
             print indexfile  , ':', msg
             sys.exit(1)
 
@@ -2063,7 +2063,7 @@
 
     try:
         fp = open(file, 'r')
-    except IOError, msg:
+    except IOError as msg:
         print file, ':', msg
         sys.exit(1)
 

Modified: python/branches/p3yk/Tools/scripts/treesync.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/treesync.py	(original)
+++ python/branches/p3yk/Tools/scripts/treesync.py	Wed Jan 10 17:19:56 2007
@@ -78,7 +78,7 @@
         print "creating slave directory", slave
         try:
             os.mkdir(slave)
-        except os.error, msg:
+        except os.error as msg:
             print "can't make slave directory", slave, ":", msg
             return
         else:

Modified: python/branches/p3yk/Tools/scripts/untabify.py
==============================================================================
--- python/branches/p3yk/Tools/scripts/untabify.py	(original)
+++ python/branches/p3yk/Tools/scripts/untabify.py	Wed Jan 10 17:19:56 2007
@@ -12,7 +12,7 @@
         opts, args = getopt.getopt(sys.argv[1:], "t:")
         if not args:
             raise getopt.error, "At least one file argument required"
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print "usage:", sys.argv[0], "[-t tabwidth] file ..."
         return
@@ -28,7 +28,7 @@
         f = open(filename)
         text = f.read()
         f.close()
-    except IOError, msg:
+    except IOError as msg:
         print "%r: I/O error: %s" % (filename, msg)
         return
     newtext = text.expandtabs(tabsize)

Modified: python/branches/p3yk/Tools/unicode/comparecodecs.py
==============================================================================
--- python/branches/p3yk/Tools/unicode/comparecodecs.py	(original)
+++ python/branches/p3yk/Tools/unicode/comparecodecs.py	Wed Jan 10 17:19:56 2007
@@ -18,11 +18,11 @@
         u = unichr(i)
         try:
             c1 = u.encode(encoding1)
-        except UnicodeError, reason:
+        except UnicodeError as reason:
             c1 = '<undefined>'
         try:
             c2 = u.encode(encoding2)
-        except UnicodeError, reason:
+        except UnicodeError as reason:
             c2 = '<undefined>'
         if c1 != c2:
             print ' * encoding mismatch for 0x%04X: %-14r != %r' % \

Modified: python/branches/p3yk/Tools/unicode/gencodec.py
==============================================================================
--- python/branches/p3yk/Tools/unicode/gencodec.py	(original)
+++ python/branches/p3yk/Tools/unicode/gencodec.py	Wed Jan 10 17:19:56 2007
@@ -130,7 +130,7 @@
     try:
         return '(' + ', '.join(['0x%0*X' % (precision, item)
                                 for item in t]) + ')'
-    except TypeError, why:
+    except TypeError as why:
         print '* failed to convert %r: %s' % (t, why)
         raise
 
@@ -393,7 +393,7 @@
             else:
                 pymap(mappathname, map, dirprefix + codefile,name,comments)
                 marshalmap(mappathname, map, dirprefix + marshalfile)
-        except ValueError, why:
+        except ValueError as why:
             print '* conversion failed: %s' % why
             raise
 
@@ -414,7 +414,7 @@
                 print '* map is empty; skipping'
             else:
                 pymap(mapname, map, dirprefix + codefile,name,comments)
-        except ValueError, why:
+        except ValueError as why:
             print '* conversion failed: %s' % why
 
 if __name__ == '__main__':

Modified: python/branches/p3yk/Tools/unicode/listcodecs.py
==============================================================================
--- python/branches/p3yk/Tools/unicode/listcodecs.py	(original)
+++ python/branches/p3yk/Tools/unicode/listcodecs.py	Wed Jan 10 17:19:56 2007
@@ -22,7 +22,7 @@
         except LookupError:
             # Codec not found
             continue
-        except Exception, reason:
+        except Exception as reason:
             # Probably an error from importing the codec; still it's
             # a valid code name
             if _debug:

Modified: python/branches/p3yk/Tools/versioncheck/pyversioncheck.py
==============================================================================
--- python/branches/p3yk/Tools/versioncheck/pyversioncheck.py	(original)
+++ python/branches/p3yk/Tools/versioncheck/pyversioncheck.py	Wed Jan 10 17:19:56 2007
@@ -49,7 +49,7 @@
         print '  Checking %s'%url
     try:
         fp = urllib.urlopen(url)
-    except IOError, arg:
+    except IOError as arg:
         if verbose >= VERBOSE_EACHFILE:
             print '    Cannot open:', arg
         return -1, None, None

Modified: python/branches/p3yk/Tools/webchecker/wcgui.py
==============================================================================
--- python/branches/p3yk/Tools/webchecker/wcgui.py	(original)
+++ python/branches/p3yk/Tools/webchecker/wcgui.py	Wed Jan 10 17:19:56 2007
@@ -74,7 +74,7 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], 't:m:qva')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stdout = sys.stderr
         print msg
         print __doc__%vars(webchecker)

Modified: python/branches/p3yk/Tools/webchecker/webchecker.py
==============================================================================
--- python/branches/p3yk/Tools/webchecker/webchecker.py	(original)
+++ python/branches/p3yk/Tools/webchecker/webchecker.py	Wed Jan 10 17:19:56 2007
@@ -153,7 +153,7 @@
 
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vxa')
-    except getopt.error, msg:
+    except getopt.error as msg:
         sys.stdout = sys.stderr
         print msg
         print __doc__%globals()
@@ -335,7 +335,7 @@
         rp.set_url(url)
         try:
             rp.read()
-        except (OSError, IOError), msg:
+        except (OSError, IOError) as msg:
             self.note(1, "I/O error parsing %s: %s", url, msg)
 
     def run(self):
@@ -402,7 +402,7 @@
             return
         try:
             page = self.getpage(url_pair)
-        except sgmllib.SGMLParseError, msg:
+        except sgmllib.SGMLParseError as msg:
             msg = self.sanitize(msg)
             self.note(0, "Error parsing %s: %s",
                           self.format_url(url_pair), msg)
@@ -541,7 +541,7 @@
         url, fragment = url_pair
         try:
             return self.urlopener.open(url)
-        except (OSError, IOError), msg:
+        except (OSError, IOError) as msg:
             msg = self.sanitize(msg)
             self.note(0, "Error %s", msg)
             if self.verbose > 0:
@@ -759,7 +759,7 @@
                 return self.open_file(url + "index.html")
             try:
                 names = os.listdir(path)
-            except os.error, msg:
+            except os.error as msg:
                 exc_type, exc_value, exc_tb = sys.exc_info()
                 raise IOError, msg, exc_tb
             names.sort()

Modified: python/branches/p3yk/Tools/webchecker/websucker.py
==============================================================================
--- python/branches/p3yk/Tools/webchecker/websucker.py	(original)
+++ python/branches/p3yk/Tools/webchecker/websucker.py	Wed Jan 10 17:19:56 2007
@@ -21,7 +21,7 @@
     verbose = webchecker.VERBOSE
     try:
         opts, args = getopt.getopt(sys.argv[1:], "qv")
-    except getopt.error, msg:
+    except getopt.error as msg:
         print msg
         print "usage:", sys.argv[0], "[-qv] ... [rooturl] ..."
         return 2
@@ -83,7 +83,7 @@
             f.write(text)
             f.close()
             self.message("saved %s", path)
-        except IOError, msg:
+        except IOError as msg:
             self.message("didn't save %s: %s", path, str(msg))
 
     def savefilename(self, url):

Modified: python/branches/p3yk/setup.py
==============================================================================
--- python/branches/p3yk/setup.py	(original)
+++ python/branches/p3yk/setup.py	Wed Jan 10 17:19:56 2007
@@ -186,7 +186,7 @@
 
         try:
             build_ext.build_extension(self, ext)
-        except (CCompilerError, DistutilsError), why:
+        except (CCompilerError, DistutilsError) as why:
             self.announce('WARNING: building of extension "%s" failed: %s' %
                           (ext.name, sys.exc_info()[1]))
             return
@@ -208,7 +208,7 @@
             self.get_ext_filename(self.get_ext_fullname(ext.name)))
         try:
             imp.load_dynamic(ext.name, ext_filename)
-        except ImportError, why:
+        except ImportError as why:
             self.announce('*** WARNING: renaming "%s" since importing it'
                           ' failed: %s' % (ext.name, why), level=3)
             assert not self.inplace


More information about the Python-3000-checkins mailing list