Rev 5374: Also pull out the 2.4-exc_info changes in http://bazaar.launchpad.net/~jameinel/bzr/2.4-613247-cleanup-tests

John Arbash Meinel john at arbash-meinel.com
Thu May 19 18:43:57 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.4-613247-cleanup-tests

------------------------------------------------------------
revno: 5374
revision-id: john at arbash-meinel.com-20110519184344-15yzs8w9qiz2t3vd
parent: john at arbash-meinel.com-20110519183939-7j7s512ep4ayds5j
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-613247-cleanup-tests
timestamp: Thu 2011-05-19 20:43:44 +0200
message:
  Also pull out the 2.4-exc_info changes
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2011-05-18 18:49:43 +0000
+++ b/bzrlib/branch.py	2011-05-19 18:43:44 +0000
@@ -3191,10 +3191,7 @@
         try:
             target.unlock()
         finally:
-            try:
-                raise exc_info[0], exc_info[1], exc_info[2]
-            finally:
-                del exc_info
+            raise exc_info[0], exc_info[1], exc_info[2]
     else:
         target.unlock()
         return result

=== modified file 'bzrlib/cleanup.py'
--- a/bzrlib/cleanup.py	2010-08-14 20:51:06 +0000
+++ b/bzrlib/cleanup.py	2011-05-19 18:43:44 +0000
@@ -188,10 +188,7 @@
                 # but don't propagate them.
                 _run_cleanup(cleanup, *c_args, **kwargs)
         if exc_info is not None:
-            try:
-                raise exc_info[0], exc_info[1], exc_info[2]
-            finally:
-                del exc_info
+            raise exc_info[0], exc_info[1], exc_info[2]
         # No error, so we can return the result
         return result
 

=== modified file 'bzrlib/decorators.py'
--- a/bzrlib/decorators.py	2011-05-18 18:49:43 +0000
+++ b/bzrlib/decorators.py	2011-05-19 18:43:44 +0000
@@ -109,10 +109,7 @@
         try:
             self.unlock()
         finally:
-            try:
-                raise exc_info[0], exc_info[1], exc_info[2]
-            finally:
-                del exc_info
+            raise exc_info[0], exc_info[1], exc_info[2]
     else:
         self.unlock()
         return result
@@ -158,10 +155,7 @@
             try:
                 self.unlock()
             finally:
-                try:
-                    raise exc_info[0], exc_info[1], exc_info[2]
-                finally:
-                    del exc_info
+                raise exc_info[0], exc_info[1], exc_info[2]
         else:
             self.unlock()
             return result
@@ -183,10 +177,7 @@
         try:
             self.unlock()
         finally:
-            try:
-                raise exc_info[0], exc_info[1], exc_info[2]
-            finally:
-                del exc_info
+            raise exc_info[0], exc_info[1], exc_info[2]
     else:
         self.unlock()
         return result
@@ -220,10 +211,7 @@
             try:
                 self.unlock()
             finally:
-                try:
-                    raise exc_info[0], exc_info[1], exc_info[2]
-                finally:
-                    del exc_info
+                raise exc_info[0], exc_info[1], exc_info[2]
         else:
             self.unlock()
             return result

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2011-05-18 18:49:43 +0000
+++ b/bzrlib/osutils.py	2011-05-19 18:43:44 +0000
@@ -261,10 +261,7 @@
             else:
                 rename_func(tmp_name, new)
     if failure_exc is not None:
-        try:
-            raise failure_exc[0], failure_exc[1], failure_exc[2]
-        finally:
-            del failure_exc
+        raise failure_exc[0], failure_exc[1], failure_exc[2]
 
 
 # In Python 2.4.2 and older, os.path.abspath and os.path.realpath

=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py	2011-05-18 18:49:43 +0000
+++ b/bzrlib/tests/test_errors.py	2011-05-19 18:43:44 +0000
@@ -577,17 +577,12 @@
         try:
             1/0
         except ZeroDivisionError:
-            err = errors.HookFailed('hook stage', 'hook name', sys.exc_info(),
-                warn=False)
-        # GZ 2010-11-08: Should not store exc_info in exception instances, but
-        #                HookFailed is deprecated anyway and could maybe go.
-        try:
-            self.assertStartsWith(
-                str(err), 'Hook \'hook name\' during hook stage failed:\n')
-            self.assertEndsWith(
-                str(err), 'integer division or modulo by zero')
-        finally:
-            del err
+            exc_info = sys.exc_info()
+        err = errors.HookFailed('hook stage', 'hook name', exc_info, warn=False)
+        self.assertStartsWith(
+            str(err), 'Hook \'hook name\' during hook stage failed:\n')
+        self.assertEndsWith(
+            str(err), 'integer division or modulo by zero')
 
     def test_tip_change_rejected(self):
         err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
@@ -616,14 +611,11 @@
         try:
             raise Exception("example error")
         except Exception:
-            err = errors.SmartMessageHandlerError(sys.exc_info())
-        # GZ 2010-11-08: Should not store exc_info in exception instances.
-        try:
-            self.assertStartsWith(
-                str(err), "The message handler raised an exception:\n")
-            self.assertEndsWith(str(err), "Exception: example error\n")
-        finally:
-            del err
+            exc_info = sys.exc_info()
+        err = errors.SmartMessageHandlerError(exc_info)
+        self.assertStartsWith(
+            str(err), "The message handler raised an exception:\n")
+        self.assertEndsWith(str(err), "Exception: example error\n")
 
     def test_must_have_working_tree(self):
         err = errors.MustHaveWorkingTree('foo', 'bar')

=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2011-05-18 18:49:43 +0000
+++ b/bzrlib/tests/test_knit.py	2011-05-19 18:43:44 +0000
@@ -444,7 +444,6 @@
         except _TestException, e:
             retry_exc = errors.RetryWithNewPacks(None, reload_occurred=False,
                                                  exc_info=sys.exc_info())
-        # GZ 2010-08-10: Cycle with exc_info affects 3 tests
         return retry_exc
 
     def test_read_from_several_packs(self):



More information about the bazaar-commits mailing list