From a704e2009ebcc1860f0822724c1ed5d0564bfcdf Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 2 Feb 2010 04:12:52 -0800 Subject: [PATCH] cython.directive(None) clears directive setting back to default value --- Cython/Compiler/ParseTreeTransforms.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index c302210a..402a0221 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -461,17 +461,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): def try_to_parse_directive(self, optname, args, kwds, pos): directivetype = Options.directive_types.get(optname) - if optname == 'infer_types': - if kwds is not None or len(args) != 1: - raise PostParseError(pos, - 'The %s directive takes one compile-time boolean argument' % optname) - elif isinstance(args[0], BoolNode): - return (optname, args[0].value) - elif isinstance(args[0], NoneNode): - return (optname, None) - else: - raise PostParseError(pos, - 'The %s directive takes one compile-time boolean argument' % optname) + if len(args) == 1 and isinstance(args[0], NoneNode): + return optname, Options.directive_defaults[optname] elif directivetype is bool: if kwds is not None or len(args) != 1 or not isinstance(args[0], BoolNode): raise PostParseError(pos, -- 2.26.2