[StGIT PATCH 3/4] Assert that the argument to Run is a sequence of strings
- From
Karl Hasselström <kha@treskal.com>
- Date
- Aug 26, 2007, 20:33 UTC
- Message-ID
- <20070826203339.16265.43048.stgit@yoghurt>
- In-Reply-To
- <20070826202724.16265.85821.stgit@yoghurt>
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@treskal.com>
---
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