From fbf8affca1a5eb139e794ae91c14ae6ccef2fc19 Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Tue, 21 Sep 1999 18:35:09 +0000 Subject: [PATCH] Typecheck elements of 'macros' parameter in 'gen_preprocess_options(). --- Lib/distutils/ccompiler.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index 0e505338be5..2a80739c7b5 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -450,6 +450,14 @@ def gen_preprocess_options (macros, includes): pp_opts = [] for macro in macros: + + if not (type (macro) is TupleType and + 1 <= len (macro) <= 2): + raise TypeError, \ + ("bad macro definition '%s': " + + "each element of 'macros' list must be a 1- or 2-tuple") % \ + macro + if len (macro) == 1: # undefine this macro pp_opts.append ("-U%s" % macro[0]) elif len (macro) == 2: