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
ff56ee9a
Commit
ff56ee9a
authored
Apr 30, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force tuple creation for generic append.
parent
2d7dcc62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
tests/run/append.pyx
tests/run/append.pyx
+9
-6
No files found.
Cython/Compiler/ExprNodes.py
View file @
ff56ee9a
...
@@ -4131,7 +4131,7 @@ static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
...
@@ -4131,7 +4131,7 @@ static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
return Py_None; // this is just to have an accurate signature
return Py_None; // this is just to have an accurate signature
}
}
else {
else {
return PyObject_CallMethod(L, "append", "
O
", x);
return PyObject_CallMethod(L, "append", "
(O)
", x);
}
}
}
}
"""
,
""
"""
,
""
...
...
tests/run/append.pyx
View file @
ff56ee9a
...
@@ -3,19 +3,21 @@ __doc__ = """
...
@@ -3,19 +3,21 @@ __doc__ = """
None
None
None
None
got error
got error
[1, 2]
[1, 2
, (3, 4)
]
>>>
test_append(A()) # doctest: +ELLIPSIS
>>>
_ = test_append(A())
appending
appending
1
1
appending
appending
2
2
appending
(3, 4)
got error
got error
<append.A instance at ...>
>>> test_append(B())
>>> test_append(B())
None
None
None
None
None
None
[1, 2, 3, 4]
None
[1, 2, (3, 4), 5, 6]
"""
"""
class
A
:
class
A
:
...
@@ -31,9 +33,10 @@ class B(list):
...
@@ -31,9 +33,10 @@ class B(list):
def
test_append
(
L
):
def
test_append
(
L
):
print
L
.
append
(
1
)
print
L
.
append
(
1
)
print
L
.
append
(
2
)
print
L
.
append
(
2
)
print
L
.
append
((
3
,
4
))
try
:
try
:
print
L
.
append
(
3
,
4
)
print
L
.
append
(
5
,
6
)
except
TypeError
:
except
TypeError
:
print
"got error"
print
"got error"
print
L
return
L
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