summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ParseTreeTransforms.py
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@gmail.com>2016-07-27 23:28:14 -0700
committerRobert Bradshaw <robertwb@gmail.com>2016-07-27 23:28:14 -0700
commit2a581a2b3d22886c76f31c9f03814f3fe42bc41f (patch)
tree98b2a94b2ca701c4f45943b7e042247a13052812 /Cython/Compiler/ParseTreeTransforms.py
parentac4cbf0265735979ea17cedf051652f8603b7034 (diff)
downloadcython-2a581a2b3d22886c76f31c9f03814f3fe42bc41f.tar.gz
Add infrastructure for migrating options to compiler directives.
Diffstat (limited to 'Cython/Compiler/ParseTreeTransforms.py')
-rw-r--r--Cython/Compiler/ParseTreeTransforms.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index b5211e45b..d0fcc59a0 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -661,7 +661,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
self.cython_module_names = set()
self.directive_names = {'staticmethod': 'staticmethod'}
self.parallel_directives = {}
- directives = copy.deepcopy(Options.directive_defaults)
+ directives = copy.deepcopy(Options.get_directive_defaults())
for key, value in compilation_directive_defaults.items():
directives[_unicode(key)] = copy.deepcopy(value)
self.directives = directives
@@ -673,8 +673,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
'is not allowed in %s scope' % (directive, scope)))
return False
else:
- if (directive not in Options.directive_defaults
- and directive not in Options.directive_types):
+ if directive not in Options.directive_types:
error(pos, "Invalid directive: '%s'." % (directive,))
return True
@@ -869,7 +868,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
def try_to_parse_directive(self, optname, args, kwds, pos):
directivetype = Options.directive_types.get(optname)
if len(args) == 1 and isinstance(args[0], ExprNodes.NoneNode):
- return optname, Options.directive_defaults[optname]
+ return optname, Options.get_directive_defaults()[optname]
elif directivetype is bool:
if kwds is not None or len(args) != 1 or not isinstance(args[0], ExprNodes.BoolNode):
raise PostParseError(pos,