Commit 3c9326ce authored by Robert Bradshaw's avatar Robert Bradshaw

Fix cdef generator property methods.

Closes github issue #1447.
parent a4440014
......@@ -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:
......
......@@ -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
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment