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
Kirill Smelkov
cython
Commits
3c9326ce
Commit
3c9326ce
authored
Sep 02, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cdef generator property methods.
Closes github issue #1447.
parent
a4440014
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+1
-1
tests/run/cdef_class_property_decorator_T264.pyx
tests/run/cdef_class_property_decorator_T264.pyx
+6
-0
tests/run/property_decorator_T593.py
tests/run/property_decorator_T593.py
+7
-0
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
3c9326ce
...
...
@@ -1313,7 +1313,7 @@ class DecoratorTransform(ScopeTrackingTransform, SkipDeclarations):
if
len
(
node
.
decorators
)
>
1
:
return
self
.
_reject_decorated_property
(
node
,
decorator_node
)
name
=
node
.
name
node
.
name
=
'__get__'
node
.
name
=
EncodedString
(
'__get__'
)
node
.
decorators
.
remove
(
decorator_node
)
stat_list
=
[
node
]
if
name
in
properties
:
...
...
tests/run/cdef_class_property_decorator_T264.pyx
View file @
3c9326ce
...
...
@@ -26,6 +26,8 @@ cdef class Prop:
DELETING '2'
>>> p.prop
GETTING 'None'
>>> list(p.generator_prop)
[42]
"""
cdef
_value
def
__init__
(
self
):
...
...
@@ -59,3 +61,7 @@ cdef class Prop:
def
my_prop
(
self
):
print
(
"GETTING '%s' via my_prop"
%
self
.
_value
)
return
self
.
_value
@
property
def
generator_prop
(
self
):
yield
42
tests/run/property_decorator_T593.py
View file @
3c9326ce
...
...
@@ -25,6 +25,9 @@ class Prop(object):
>>> p.my_prop
GETTING 'my_prop'
389
>>> list(p.generator_prop)
[42]
"""
_value
=
None
...
...
@@ -47,3 +50,7 @@ class Prop(object):
def
my_prop
(
self
):
print
(
"GETTING 'my_prop'"
)
return
389
@
property
def
generator_prop
(
self
):
yield
42
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