Commit a704e200 authored by Robert Bradshaw's avatar Robert Bradshaw

cython.directive(None) clears directive setting back to default value

parent c585280a
...@@ -461,17 +461,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): ...@@ -461,17 +461,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
def try_to_parse_directive(self, optname, args, kwds, pos): def try_to_parse_directive(self, optname, args, kwds, pos):
directivetype = Options.directive_types.get(optname) directivetype = Options.directive_types.get(optname)
if optname == 'infer_types': if len(args) == 1 and isinstance(args[0], NoneNode):
if kwds is not None or len(args) != 1: return optname, Options.directive_defaults[optname]
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)
elif directivetype is bool: elif directivetype is bool:
if kwds is not None or len(args) != 1 or not isinstance(args[0], BoolNode): if kwds is not None or len(args) != 1 or not isinstance(args[0], BoolNode):
raise PostParseError(pos, raise PostParseError(pos,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment