Rev 5319: Make bzrlib.commands importable under Python 3. in http://bazaar.launchpad.net/~lifeless/bzr/py3

Robert Collins robertc at robertcollins.net
Tue Jun 22 20:56:18 BST 2010


At http://bazaar.launchpad.net/~lifeless/bzr/py3

------------------------------------------------------------
revno: 5319
revision-id: robertc at robertcollins.net-20100622195616-9kq0y1undfpwbm1p
parent: robertc at robertcollins.net-20100622194851-6swtleokl4ihoo9p
committer: Robert Collins <robertc at robertcollins.net>
branch nick: py3
timestamp: Wed 2010-06-23 07:56:16 +1200
message:
  Make bzrlib.commands importable under Python 3.
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2010-05-27 21:16:48 +0000
+++ b/bzrlib/commands.py	2010-06-22 19:56:16 +0000
@@ -909,13 +909,13 @@
     """
     try:
         return the_callable(*args, **kwargs)
-    except (KeyboardInterrupt, Exception), e:
+    except (KeyboardInterrupt, Exception):
         # used to handle AssertionError and KeyboardInterrupt
         # specially here, but hopefully they're handled ok by the logger now
         exc_info = sys.exc_info()
         exitcode = trace.report_exception(exc_info, sys.stderr)
         if os.environ.get('BZR_PDB'):
-            print '**** entering debugger'
+            print('**** entering debugger')
             tb = exc_info[2]
             import pdb
             if sys.version_info[:2] < (2, 6):
@@ -1124,7 +1124,8 @@
             result = func(*args, **kwargs)
             sys.stdout.flush()
             return result
-        except IOError, e:
+        except IOError:
+            e = sys.exc_info()[1]
             if getattr(e, 'errno', None) is None:
                 raise
             if e.errno != errno.EPIPE:
@@ -1215,7 +1216,8 @@
     install_bzr_command_hooks()
     try:
         return run_bzr(argv)
-    except Exception, e:
+    except Exception:
+        e = sys.exc_info()[1]
         if (isinstance(e, (OSError, IOError))
             or not getattr(e, 'internal_error', True)):
             trace.report_exception(sys.exc_info(), sys.stderr)




More information about the bazaar-commits mailing list