Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
f0efaf57
Commit
f0efaf57
authored
Mar 31, 2011
by
Haoyu Bai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent the directive dicts from being shared among nodes and compilations
parent
3069c3e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+7
-3
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+3
-3
No files found.
Cython/Compiler/Nodes.py
View file @
f0efaf57
...
@@ -925,9 +925,11 @@ class CVarDefNode(StatNode):
...
@@ -925,9 +925,11 @@ class CVarDefNode(StatNode):
child_attrs
=
[
"base_type"
,
"declarators"
]
child_attrs
=
[
"base_type"
,
"declarators"
]
decorators
=
None
decorators
=
None
directive_locals
=
{}
directive_locals
=
None
def
analyse_declarations
(
self
,
env
,
dest_scope
=
None
):
def
analyse_declarations
(
self
,
env
,
dest_scope
=
None
):
if
self
.
directive_locals
is
None
:
self
.
directive_locals
=
{}
if
not
dest_scope
:
if
not
dest_scope
:
dest_scope
=
env
dest_scope
=
env
self
.
dest_scope
=
dest_scope
self
.
dest_scope
=
dest_scope
...
@@ -962,7 +964,7 @@ class CVarDefNode(StatNode):
...
@@ -962,7 +964,7 @@ class CVarDefNode(StatNode):
cname
=
cname
,
visibility
=
self
.
visibility
,
in_pxd
=
self
.
in_pxd
,
cname
=
cname
,
visibility
=
self
.
visibility
,
in_pxd
=
self
.
in_pxd
,
api
=
self
.
api
)
api
=
self
.
api
)
if
entry
is
not
None
:
if
entry
is
not
None
:
entry
.
directive_locals
=
self
.
directive_locals
entry
.
directive_locals
=
copy
.
copy
(
self
.
directive_locals
)
else
:
else
:
if
self
.
directive_locals
:
if
self
.
directive_locals
:
error
(
self
.
pos
,
"Decorators can only be followed by functions"
)
error
(
self
.
pos
,
"Decorators can only be followed by functions"
)
...
@@ -1638,12 +1640,14 @@ class CFuncDefNode(FuncDefNode):
...
@@ -1638,12 +1640,14 @@ class CFuncDefNode(FuncDefNode):
inline_in_pxd
=
False
inline_in_pxd
=
False
decorators
=
None
decorators
=
None
directive_locals
=
{}
directive_locals
=
None
def
unqualified_name
(
self
):
def
unqualified_name
(
self
):
return
self
.
entry
.
name
return
self
.
entry
.
name
def
analyse_declarations
(
self
,
env
):
def
analyse_declarations
(
self
,
env
):
if
self
.
directive_locals
is
None
:
self
.
directive_locals
=
{}
self
.
directive_locals
.
update
(
env
.
directives
[
'locals'
])
self
.
directive_locals
.
update
(
env
.
directives
[
'locals'
])
base_type
=
self
.
base_type
.
analyse
(
env
)
base_type
=
self
.
base_type
.
analyse
(
env
)
# The 2 here is because we need both function and argument names.
# The 2 here is because we need both function and argument names.
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
f0efaf57
...
@@ -584,7 +584,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
...
@@ -584,7 +584,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
super
(
InterpretCompilerDirectives
,
self
).
__init__
(
context
)
super
(
InterpretCompilerDirectives
,
self
).
__init__
(
context
)
self
.
compilation_directive_defaults
=
{}
self
.
compilation_directive_defaults
=
{}
for
key
,
value
in
compilation_directive_defaults
.
items
():
for
key
,
value
in
compilation_directive_defaults
.
items
():
self
.
compilation_directive_defaults
[
unicode
(
key
)]
=
value
self
.
compilation_directive_defaults
[
unicode
(
key
)]
=
copy
.
deepcopy
(
value
)
self
.
cython_module_names
=
cython
.
set
()
self
.
cython_module_names
=
cython
.
set
()
self
.
directive_names
=
{}
self
.
directive_names
=
{}
...
@@ -604,8 +604,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
...
@@ -604,8 +604,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
self
.
wrong_scope_error
(
node
.
pos
,
key
,
'module'
)
self
.
wrong_scope_error
(
node
.
pos
,
key
,
'module'
)
del
node
.
directive_comments
[
key
]
del
node
.
directive_comments
[
key
]
directives
=
copy
.
copy
(
Options
.
directive_defaults
)
directives
=
copy
.
deep
copy
(
Options
.
directive_defaults
)
directives
.
update
(
self
.
compilation_directive_defaults
)
directives
.
update
(
copy
.
deepcopy
(
self
.
compilation_directive_defaults
)
)
directives
.
update
(
node
.
directive_comments
)
directives
.
update
(
node
.
directive_comments
)
self
.
directives
=
directives
self
.
directives
=
directives
node
.
directives
=
directives
node
.
directives
=
directives
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment