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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
65abcc7f
Commit
65abcc7f
authored
Mar 14, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
71295b90
3d30a2a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+24
-15
tests/compile/typecast.pyx
tests/compile/typecast.pyx
+1
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
65abcc7f
...
...
@@ -3042,21 +3042,10 @@ class SequenceNode(NewTempExprNode):
code
.
putln
(
"} else {"
)
if
rhs
.
type
is
tuple_type
:
code
.
globalstate
.
use_utility_code
(
raise_none_iter_error_utility_code
)
code
.
putln
(
"if (%s == Py_None) {"
%
rhs
.
py_result
())
code
.
putln
(
"__Pyx_RaiseNoneNotIterableError();"
)
code
.
putln
(
"} else if (PyTuple_GET_SIZE(%s) < %s) {"
%
(
code
.
globalstate
.
use_utility_code
(
tuple_unpacking_error_code
)
code
.
putln
(
"__Pyx_UnpackTupleError(%s, %s);"
%
(
rhs
.
py_result
(),
len
(
self
.
args
)))
code
.
globalstate
.
use_utility_code
(
raise_need_more_values_to_unpack
)
code
.
putln
(
"__Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(%s));"
%
rhs
.
py_result
());
code
.
putln
(
"} else {"
)
code
.
globalstate
.
use_utility_code
(
raise_need_more_values_to_unpack
)
code
.
putln
(
"__Pyx_RaiseTooManyValuesError();"
);
code
.
putln
(
"}"
)
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
else
:
code
.
putln
(
"%s = PyObject_GetIter(%s); %s"
%
(
...
...
@@ -5570,6 +5559,26 @@ static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
#------------------------------------------------------------------------------------
tuple_unpacking_error_code
=
UtilityCode
(
proto
=
"""
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
"""
,
impl
=
"""
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
if (t == Py_None) {
__Pyx_RaiseNoneNotIterableError();
} else if (PyTuple_GET_SIZE(t) < index) {
__Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
} else {
__Pyx_RaiseTooManyValuesError();
}
}
"""
,
requires
=
[
raise_none_iter_error_utility_code
,
raise_need_more_values_to_unpack
,
raise_too_many_values_to_unpack
]
)
unpacking_utility_code
=
UtilityCode
(
proto
=
"""
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
...
...
tests/compile/typecast.pyx
View file @
65abcc7f
cdef
void
f
(
obj
):
cdef
int
i
=
0
cdef
char
*
p
p
=
<
char
*>
i
p
=
<
char
*>&
i
obj
=
<
object
>
p
p
=
<
char
*>
obj
...
...
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