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
Boxiang Sun
cython
Commits
91d85432
Commit
91d85432
authored
Mar 11, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix unused access to optimise builtin methods which could lead to invalid C code being generated
parent
390d3af5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-1
tests/run/bound_builtin_methods_T589.pyx
tests/run/bound_builtin_methods_T589.pyx
+16
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
91d85432
...
...
@@ -5135,8 +5135,13 @@ class AttributeNode(ExprNode):
return
"((struct %s *)%s%s%s)->%s"
%
(
obj
.
type
.
vtabstruct_cname
,
obj_code
,
self
.
op
,
obj
.
type
.
vtabslot_cname
,
self
.
member
)
el
se
:
el
if
self
.
result_is_used
:
return
self
.
member
# Generating no code at all for unused access to optimised builtin
# methods fixes the problem that some optimisations only exist as
# macros, i.e. there is no function pointer to them, so we would
# generate invalid C code here.
return
elif
obj
.
type
.
is_complex
:
return
"__Pyx_C%s(%s)"
%
(
self
.
member
.
upper
(),
obj_code
)
else
:
...
...
tests/run/bound_builtin_methods_T589.pyx
View file @
91d85432
...
...
@@ -4,6 +4,7 @@ cimport cython
_set
=
set
# CPython may not define it (in Py2.3), but Cython does :)
def
test_set_clear_bound
():
"""
>>> type(test_set_clear_bound()) is _set
...
...
@@ -19,6 +20,7 @@ def test_set_clear_bound():
text
=
u'ab jd sdflk as sa sadas asdas fsdf '
pipe_sep
=
u'|'
@
cython
.
test_assert_path_exists
(
"//SimpleCallNode"
,
"//SimpleCallNode//NameNode"
)
...
...
@@ -34,3 +36,17 @@ def test_unicode_join_bound(unicode sep, l):
"""
join
=
sep
.
join
return
join
(
l
)
def
test_unicode_join_bound_no_assignment
(
unicode
sep
):
"""
>>> test_unicode_join_bound_no_assignment(text)
"""
sep
.
join
def
test_dict_items_bound_no_assignment
(
dict
d
):
"""
>>> test_dict_items_bound_no_assignment({1:2})
"""
d
.
items
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