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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
7b3d38c8
Commit
7b3d38c8
authored
Aug 05, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix precedence rules of decorator options.
parent
40f52c12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+18
-14
tests/run/bufaccess.pyx
tests/run/bufaccess.pyx
+1
-0
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
7b3d38c8
...
@@ -330,20 +330,17 @@ class ResolveOptions(CythonTransform):
...
@@ -330,20 +330,17 @@ class ResolveOptions(CythonTransform):
return
None
return
None
def
visit_with_options
(
self
,
node
,
options
):
def
visit_with_options
(
self
,
node
,
options
):
if
not
options
:
oldoptions
=
self
.
options
return
self
.
visit_Node
(
node
)
newoptions
=
copy
.
copy
(
oldoptions
)
else
:
newoptions
.
update
(
options
)
oldoptions
=
self
.
options
self
.
options
=
newoptions
newoptions
=
copy
.
copy
(
oldoptions
)
node
=
self
.
visit_Node
(
node
)
newoptions
.
update
(
options
)
self
.
options
=
oldoptions
self
.
options
=
newoptions
node
=
self
.
visit_Node
(
node
)
self
.
options
=
oldoptions
return
node
return
node
# Handle decorators
# Handle decorators
def
visit_DefNode
(
self
,
node
):
def
visit_DefNode
(
self
,
node
):
options
=
{}
options
=
[]
if
node
.
decorators
:
if
node
.
decorators
:
# Split the decorators into two lists -- real decorators and options
# Split the decorators into two lists -- real decorators and options
...
@@ -351,14 +348,21 @@ class ResolveOptions(CythonTransform):
...
@@ -351,14 +348,21 @@ class ResolveOptions(CythonTransform):
for
dec
in
node
.
decorators
:
for
dec
in
node
.
decorators
:
option
=
self
.
try_to_parse_option
(
dec
.
decorator
)
option
=
self
.
try_to_parse_option
(
dec
.
decorator
)
if
option
is
not
None
:
if
option
is
not
None
:
name
,
value
=
option
options
.
append
(
option
)
options
[
name
]
=
value
else
:
else
:
realdecs
.
append
(
dec
)
realdecs
.
append
(
dec
)
node
.
decorators
=
realdecs
node
.
decorators
=
realdecs
return
self
.
visit_with_options
(
node
,
options
)
if
options
:
optdict
=
{}
options
.
reverse
()
# Decorators coming first take precedence
for
option
in
options
:
name
,
value
=
option
optdict
[
name
]
=
value
return
self
.
visit_with_options
(
node
,
options
)
else
:
return
self
.
visit_Node
(
node
)
# Handle with statements
# Handle with statements
def
visit_WithStatNode
(
self
,
node
):
def
visit_WithStatNode
(
self
,
node
):
option
=
self
.
try_to_parse_option
(
node
.
manager
)
option
=
self
.
try_to_parse_option
(
node
.
manager
)
...
...
tests/run/bufaccess.pyx
View file @
7b3d38c8
...
@@ -543,6 +543,7 @@ def safe_get(object[int] buf, int idx):
...
@@ -543,6 +543,7 @@ def safe_get(object[int] buf, int idx):
@
testcase
@
testcase
@
cython
.
boundscheck
(
False
)
@
cython
.
boundscheck
(
False
)
@
cython
.
boundscheck
(
True
)
def
unsafe_get
(
object
[
int
]
buf
,
int
idx
):
def
unsafe_get
(
object
[
int
]
buf
,
int
idx
):
"""
"""
Access outside of the area the buffer publishes.
Access outside of the area the buffer publishes.
...
...
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