From: Stefan Behnel Date: Sun, 6 Dec 2009 11:04:41 +0000 (+0100) Subject: keep ignoring unknown directives in directive comments X-Git-Tag: 0.12.1~74 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f95dba7d4bf8fedbd2ec4850492311688541e0b;p=cython.git keep ignoring unknown directives in directive comments --- diff --git a/Cython/Compiler/Options.py b/Cython/Compiler/Options.py index d5a540d7..28ccc5e3 100644 --- a/Cython/Compiler/Options.py +++ b/Cython/Compiler/Options.py @@ -120,7 +120,7 @@ def parse_directive_value(name, value, relaxed_bool=False): else: assert False -def parse_directive_list(s, relaxed_bool=False): +def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False): """ Parses a comma-seperated list of pragma options. Whitespace is not considered. @@ -151,6 +151,8 @@ def parse_directive_list(s, relaxed_bool=False): name, value = [ s.strip() for s in item.strip().split('=', 1) ] parsed_value = parse_directive_value(name, value, relaxed_bool=relaxed_bool) if parsed_value is None: - raise ValueError('Unknown option: "%s"' % name) - result[name] = parsed_value + if not ignore_unknown: + raise ValueError('Unknown option: "%s"' % name) + else: + result[name] = parsed_value return result diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 73345a98..0f5371cc 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -2588,7 +2588,8 @@ def p_compiler_directive_comments(s): if m: directives = m.group(1).strip() try: - result.update( Options.parse_directive_list(directives) ) + result.update( Options.parse_directive_list( + directives, ignore_unknown=True) ) except ValueError, e: s.error(e.args[0], fatal=False) s.next()