[StGIT PATCH 3/4] Assert that the argument to Run is a sequence of strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This runtime assertion makes bugs easier to find.

In most other languages, we'd have been able to check this at compile
time. But this is Python. Yay!

Signed-off-by: Karl Hasselström <kha@xxxxxxxxxxx>

---

 stgit/run.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/stgit/run.py b/stgit/run.py
index d925cce..1bc4759 100644
--- a/stgit/run.py
+++ b/stgit/run.py
@@ -31,6 +31,9 @@ class Run:
     exc = RunException
     def __init__(self, *cmd):
         self.__cmd = list(cmd)
+        for c in cmd:
+            if type(c) != str:
+                raise Exception, 'Bad command: %r' % cmd
         self.__good_retvals = [0]
         self.__env = None
         self.__indata = None

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux