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
Boxiang Sun
cython
Commits
b309d5dd
Commit
b309d5dd
authored
Aug 13, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix closure handling for decorated methods after changing function decorator implementation
parent
c40ff48f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+4
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+3
-3
No files found.
Cython/Compiler/Nodes.py
View file @
b309d5dd
...
...
@@ -1959,6 +1959,7 @@ class DefNode(FuncDefNode):
# when the def statement is inside a Python class definition.
#
# assmt AssignmentNode Function construction/assignment
# py_cfunc_node PyCFunctionNode/InnerFunctionNode The PyCFunction to create and assign
child_attrs
=
[
"args"
,
"star_arg"
,
"starstar_arg"
,
"body"
,
"decorators"
]
...
...
@@ -1974,6 +1975,7 @@ class DefNode(FuncDefNode):
entry
=
None
acquire_gil
=
0
self_in_stararg
=
0
py_cfunc_node
=
None
doc
=
None
def
__init__
(
self
,
pos
,
**
kwds
):
...
...
@@ -2314,10 +2316,10 @@ class DefNode(FuncDefNode):
genv
=
genv
.
outer_scope
if
genv
.
is_closure_scope
:
rhs
=
ExprNodes
.
InnerFunctionNode
(
rhs
=
self
.
py_cfunc_node
=
ExprNodes
.
InnerFunctionNode
(
self
.
pos
,
pymethdef_cname
=
self
.
entry
.
pymethdef_cname
)
else
:
rhs
=
ExprNodes
.
PyCFunctionNode
(
rhs
=
self
.
py_cfunc_node
=
ExprNodes
.
PyCFunctionNode
(
self
.
pos
,
pymethdef_cname
=
self
.
entry
.
pymethdef_cname
,
binding
=
env
.
directives
[
'binding'
])
if
env
.
is_py_class_scope
:
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
b309d5dd
...
...
@@ -1205,7 +1205,7 @@ class DecoratorTransform(ScopeTrackingTransform, SkipDeclarations):
def
visit_DefNode
(
self
,
func_node
):
scope_type
=
self
.
scope_type
func_node
=
self
.
visit_FuncDefNode
(
func_node
)
if
scope_type
is
not
'cclass'
or
not
func_node
.
decorators
:
if
scope_type
!=
'cclass'
or
not
func_node
.
decorators
:
return
func_node
return
self
.
_handle_decorators
(
func_node
,
func_node
.
name
)
...
...
@@ -2001,9 +2001,9 @@ class CreateClosureClasses(CythonTransform):
if
not
from_closure
and
(
self
.
path
or
inner_node
):
if
not
inner_node
:
if
not
node
.
assmt
:
if
not
node
.
py_cfunc_node
:
raise
InternalError
,
"DefNode does not have assignment node"
inner_node
=
node
.
assmt
.
rhs
inner_node
=
node
.
py_cfunc_node
inner_node
.
needs_self_code
=
False
node
.
needs_outer_scope
=
False
...
...
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