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
3853c437
Commit
3853c437
authored
Feb 16, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make unpacking exception strings look like those generated by Python itself
parent
595c2453
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+13
-11
No files found.
Cython/Compiler/ExprNodes.py
View file @
3853c437
...
...
@@ -2133,8 +2133,8 @@ class SequenceNode(ExprNode):
rhs
.
generate_disposal_code
(
code
)
for
i
in
range
(
len
(
self
.
args
)):
item
=
self
.
unpacked_items
[
i
]
unpack_code
=
"__Pyx_UnpackItem(%s)"
%
(
self
.
iterator
.
py_result
())
unpack_code
=
"__Pyx_UnpackItem(%s
, %d
)"
%
(
self
.
iterator
.
py_result
()
,
i
)
code
.
putln
(
"%s = %s; %s"
%
(
item
.
result_code
,
...
...
@@ -3879,18 +3879,20 @@ bad:
unpacking_utility_code
=
[
"""
static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
static PyObject *__Pyx_UnpackItem(PyObject *
, Py_ssize_t index
); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/
"""
,
"""
static void __Pyx_UnpackError(void) {
PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
}
static PyObject *__Pyx_UnpackItem(PyObject *iter) {
static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
PyObject *item;
if (!(item = PyIter_Next(iter))) {
if (!PyErr_Occurred())
__Pyx_UnpackError();
if (!PyErr_Occurred()) {
PyErr_Format(PyExc_ValueError,
#if PY_VERSION_HEX < 0x02050000
"need more than %d values to unpack", (int)index);
#else
"need more than %zd values to unpack", index);
#endif
}
}
return item;
}
...
...
@@ -3899,7 +3901,7 @@ static int __Pyx_EndUnpack(PyObject *iter) {
PyObject *item;
if ((item = PyIter_Next(iter))) {
Py_DECREF(item);
__Pyx_UnpackError(
);
PyErr_SetString(PyExc_ValueError, "too many values to unpack"
);
return -1;
}
else if (!PyErr_Occurred())
...
...
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