[Lldb-commits] [lldb] r251977 - Python 3: Modernize exception raising syntax.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 3 13:01:45 PST 2015


Author: zturner
Date: Tue Nov  3 15:01:45 2015
New Revision: 251977

URL: http://llvm.org/viewvc/llvm-project?rev=251977&view=rev
Log:
Python 3: Modernize exception raising syntax.

Old-style: `raise foo, bar`
New-style: `raise foo(bar)`

These two statements are equivalent, but the former is an error in
Python 3.

Modified:
    lldb/trunk/third_party/Python/module/unittest2/unittest2/case.py
    lldb/trunk/utils/sync-source/syncsource.py

Modified: lldb/trunk/third_party/Python/module/unittest2/unittest2/case.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/third_party/Python/module/unittest2/unittest2/case.py?rev=251977&r1=251976&r2=251977&view=diff
==============================================================================
--- lldb/trunk/third_party/Python/module/unittest2/unittest2/case.py (original)
+++ lldb/trunk/third_party/Python/module/unittest2/unittest2/case.py Tue Nov  3 15:01:45 2015
@@ -510,7 +510,7 @@ class TestCase(unittest.TestCase):
             excName = excClass.__name__
         else:
             excName = str(excClass)
-        raise self.failureException, "%s not raised" % excName
+        raise self.failureException("%s not raised" % excName)
 
     def _getAssertEqualityFunc(self, first, second):
         """Get a detailed comparison function for the types of the two args.
@@ -1028,7 +1028,7 @@ class TestCase(unittest.TestCase):
                 excName = expected_exception.__name__
             else: 
                 excName = str(expected_exception)
-            raise self.failureException, "%s not raised" % excName
+            raise self.failureException("%s not raised" % excName)
 
 
     def assertRegexpMatches(self, text, expected_regexp, msg=None):

Modified: lldb/trunk/utils/sync-source/syncsource.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/sync-source/syncsource.py?rev=251977&r1=251976&r2=251977&view=diff
==============================================================================
--- lldb/trunk/utils/sync-source/syncsource.py (original)
+++ lldb/trunk/utils/sync-source/syncsource.py Tue Nov  3 15:01:45 2015
@@ -234,7 +234,7 @@ def sync_configured_sources(options, con
     if len(transfer_specs) > 0:
         transfer_agent.transfer(transfer_specs, options.dry_run)
     else:
-        raise "nothing to transfer, bad configuration?"
+        raise Exception("nothing to transfer, bad configuration?")
 
 
 def main():




More information about the lldb-commits mailing list