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
Gwenaël Samain
cython
Commits
135e52d5
Commit
135e52d5
authored
May 23, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix access to attributes of optimised builtin methods (e.g. '__name__')
parent
3d10caf5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
1 deletion
+36
-1
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
tests/run/append.pyx
tests/run/append.pyx
+8
-0
tests/run/list_pop.pyx
tests/run/list_pop.pyx
+8
-0
tests/run/qualname.pyx
tests/run/qualname.pyx
+16
-0
No files found.
CHANGES.rst
View file @
135e52d5
...
...
@@ -15,6 +15,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.
...
...
Cython/Compiler/ExprNodes.py
View file @
135e52d5
...
...
@@ -5436,7 +5436,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
...
...
tests/run/append.pyx
View file @
135e52d5
...
...
@@ -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__
tests/run/list_pop.pyx
View file @
135e52d5
...
...
@@ -199,3 +199,11 @@ def crazy_pop(L):
(1, 2, 3)
"""
return
L
.
pop
(
1
,
2
,
3
)
def
method_name
():
"""
>>> method_name()
'pop'
"""
return
[].
pop
.
__name__
tests/run/qualname.pyx
View file @
135e52d5
...
...
@@ -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()
...
...
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