From: Karl Hasselström Date: Fri, 24 Aug 2007 11:26:01 +0000 (+0200) Subject: Assert that the argument to Run is a sequence of strings X-Git-Tag: v0.14~112 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/06104c208673fdfdbcc320d59e8fb9658330edc3?ds=sidebyside Assert that the argument to Run is a sequence of strings 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 --- 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