Commit 18f4888f authored by Stefan Behnel's avatar Stefan Behnel

clean up directives setup in InterpretCompilerDirectives transform by moving...

clean up directives setup in InterpretCompilerDirectives transform by moving the global part into __init__()
parent e8330efc
...@@ -670,12 +670,13 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): ...@@ -670,12 +670,13 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
def __init__(self, context, compilation_directive_defaults): def __init__(self, context, compilation_directive_defaults):
super(InterpretCompilerDirectives, self).__init__(context) super(InterpretCompilerDirectives, self).__init__(context)
self.compilation_directive_defaults = {}
for key, value in compilation_directive_defaults.items():
self.compilation_directive_defaults[unicode(key)] = copy.deepcopy(value)
self.cython_module_names = set() self.cython_module_names = set()
self.directive_names = {'staticmethod': 'staticmethod'} self.directive_names = {'staticmethod': 'staticmethod'}
self.parallel_directives = {} self.parallel_directives = {}
directives = copy.deepcopy(Options.directive_defaults)
for key, value in compilation_directive_defaults.items():
directives[unicode(key)] = copy.deepcopy(value)
self.directives = directives
def check_directive_scope(self, pos, directive, scope): def check_directive_scope(self, pos, directive, scope):
legal_scopes = Options.directive_scopes.get(directive, None) legal_scopes = Options.directive_scopes.get(directive, None)
...@@ -698,11 +699,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): ...@@ -698,11 +699,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
self.module_scope = node.scope self.module_scope = node.scope
directives = copy.deepcopy(Options.directive_defaults) self.directives.update(node.directive_comments)
directives.update(copy.deepcopy(self.compilation_directive_defaults)) node.directives = self.directives
directives.update(node.directive_comments)
self.directives = directives
node.directives = directives
node.parallel_directives = self.parallel_directives node.parallel_directives = self.parallel_directives
self.visitchildren(node) self.visitchildren(node)
node.cython_module_names = self.cython_module_names node.cython_module_names = self.cython_module_names
......
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