[PATCH] D25410: [lit] Fix undefined symbol ArgumentError

Brian Gesiak via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 9 13:59:53 PDT 2016


modocache created this revision.
modocache added reviewers: ddunbar, echristo, delcypher, beanz.
modocache added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

`ArgumentError` is not defined by the Python standard library.
Executing this line of code would throw a exception, but not the
intended one. It would throw a `NameError` exception, since `ArgumentError`
is undefined.

Use `ValueError` instead, which is defined by the Python standard
library.


https://reviews.llvm.org/D25410

Files:
  utils/lit/lit/Test.py


Index: utils/lit/lit/Test.py
===================================================================
--- utils/lit/lit/Test.py
+++ utils/lit/lit/Test.py
@@ -189,9 +189,9 @@
 
     def setResult(self, result):
         if self.result is not None:
-            raise ArgumentError("test result already set")
+            raise ValueError("test result already set")
         if not isinstance(result, Result):
-            raise ArgumentError("unexpected result type")
+            raise ValueError("unexpected result type")
 
         self.result = result
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25410.74081.patch
Type: text/x-patch
Size: 552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161009/616639a9/attachment.bin>


More information about the llvm-commits mailing list