summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-08-31 09:54:03 -0500
committerBryan Bishop <kanzure@gmail.com>2013-08-31 09:54:03 -0500
commit93514b18629fe42c0a2688dac57d90998ea5daaa (patch)
tree3399beb8b6f89bab42f7b56b0a6eedaed14b4d02
parent95f7270141cbdb32c7d178a8a89a822e66e3a113 (diff)
convert a macro_translator assert in preprocessor
AssertionError -> PreprocessorException
-rw-r--r--preprocessor.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/preprocessor.py b/preprocessor.py
index daed157d4..c6ae137c4 100644
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -534,9 +534,15 @@ def macro_translator(macro, token, line):
else:
allowed_lengths = [allowed_length]
- assert len(params) in allowed_lengths, \
- "mismatched number of parameters on this line: " + \
- original_line
+ if len(params) not in allowed_lengths:
+ raise PreprocessorException(
+ "mismatched number of parameters ({count}, instead of any of {allowed}) on this line: {line}"
+ .format(
+ count=len(params),
+ allowed=allowed_lengths,
+ line=original_line,
+ )
+ )
# --- end of ridiculously long sanity check ---