Commit bdc95095 authored by Stefan Behnel's avatar Stefan Behnel

merge 0.20.x branch into master

parents fea7ad6e 135e52d5
......@@ -63,6 +63,9 @@ Features added
Bugs fixed
----------
* Access to attributes of optimised builtin methods (e.g.
``[].append.__name__``) could fail to compile.
* Memory leak when extension subtypes add a memory view as attribute
to those of the parent type without having Python object attributes
or a user provided dealloc method.
......
......@@ -5445,7 +5445,7 @@ class AttributeNode(ExprNode):
if obj_type.can_coerce_to_pyobject(env):
if not immutable_obj:
self.obj = self.obj.coerce_to_pyobject(env)
elif (obj_type.is_cfunction and self.obj.is_name
elif (obj_type.is_cfunction and (self.obj.is_name or self.obj.is_attribute)
and self.obj.entry.as_variable
and self.obj.entry.as_variable.type.is_pyobject):
# might be an optimised builtin function => unpack it
......
......@@ -63,3 +63,11 @@ def append_unused_retval(L):
except TypeError:
print u"got error"
return L
def method_name():
"""
>>> method_name()
'append'
"""
return [].append.__name__
......@@ -203,6 +203,14 @@ def crazy_pop(L):
return L.pop(1, 2, 3)
def method_name():
"""
>>> method_name()
'pop'
"""
return [].pop.__name__
def object_pop_large_int():
"""
>>> object_pop_large_int()
......
......@@ -2,6 +2,8 @@
# mode: run
# tag: cyfunction,qualname
import sys
def test_qualname():
"""
......@@ -16,6 +18,20 @@ def test_qualname():
"""
def test_builtin_qualname():
"""
>>> test_builtin_qualname()
list.append
len
"""
if sys.version_info >= (3, 3):
print([1, 2, 3].append.__qualname__)
print(len.__qualname__)
else:
print('list.append')
print('len')
def test_nested_qualname():
"""
>>> outer, lambda_func, XYZ = test_nested_qualname()
......
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