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): ...@@ -1313,7 +1313,7 @@ class DecoratorTransform(ScopeTrackingTransform, SkipDeclarations):
if len(node.decorators) > 1: if len(node.decorators) > 1:
return self._reject_decorated_property(node, decorator_node) return self._reject_decorated_property(node, decorator_node)
name = node.name name = node.name
node.name = '__get__' node.name = EncodedString('__get__')
node.decorators.remove(decorator_node) node.decorators.remove(decorator_node)
stat_list = [node] stat_list = [node]
if name in properties: if name in properties:
......
...@@ -26,6 +26,8 @@ cdef class Prop: ...@@ -26,6 +26,8 @@ cdef class Prop:
DELETING '2' DELETING '2'
>>> p.prop >>> p.prop
GETTING 'None' GETTING 'None'
>>> list(p.generator_prop)
[42]
""" """
cdef _value cdef _value
def __init__(self): def __init__(self):
...@@ -59,3 +61,7 @@ cdef class Prop: ...@@ -59,3 +61,7 @@ cdef class Prop:
def my_prop(self): def my_prop(self):
print("GETTING '%s' via my_prop" % self._value) print("GETTING '%s' via my_prop" % self._value)
return self._value return self._value
@property
def generator_prop(self):
yield 42
...@@ -25,6 +25,9 @@ class Prop(object): ...@@ -25,6 +25,9 @@ class Prop(object):
>>> p.my_prop >>> p.my_prop
GETTING 'my_prop' GETTING 'my_prop'
389 389
>>> list(p.generator_prop)
[42]
""" """
_value = None _value = None
...@@ -47,3 +50,7 @@ class Prop(object): ...@@ -47,3 +50,7 @@ class Prop(object):
def my_prop(self): def my_prop(self):
print("GETTING 'my_prop'") print("GETTING 'my_prop'")
return 389 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