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
6b692963
Commit
6b692963
authored
Aug 21, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make decorators an attribute of PyClassDefNode
parent
a31a76c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-1
tests/run/decorator_lambda.pyx
tests/run/decorator_lambda.pyx
+15
-0
No files found.
Cython/Compiler/Nodes.py
View file @
6b692963
...
...
@@ -3793,7 +3793,7 @@ class PyClassDefNode(ClassDefNode):
# target NameNode Variable to assign class object to
child_attrs
=
[
"body"
,
"dict"
,
"metaclass"
,
"mkw"
,
"bases"
,
"class_result"
,
"target"
,
"class_cell"
]
"target"
,
"class_cell"
,
"decorators"
]
decorators
=
None
class_result
=
None
py3_style_class
=
False
# Python3 style class (bases+kwargs)
...
...
@@ -3910,6 +3910,7 @@ class PyClassDefNode(ClassDefNode):
decorator
.
pos
,
function
=
decorator
.
decorator
,
args
=
[
class_result
])
self
.
decorators
=
None
self
.
class_result
=
class_result
self
.
class_result
.
analyse_declarations
(
env
)
self
.
target
.
analyse_target_declaration
(
env
)
...
...
tests/run/decorator_lambda.pyx
0 → 100644
View file @
6b692963
# mode: run
# tag: decorator, lambda
def
decorate
(
f
):
return
f
@
decorate
(
lambda
x
:
x
)
class
TestClassDecorator
(
object
):
"""
>>> obj = TestClassDecorator()
>>> obj.hello()
'Hello, world!'
"""
def
hello
(
self
):
return
"Hello, world!"
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