Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: Python/ceval.c

Issue 4806: Function calls taking a generator as star argument can mask TypeErrors in the generator
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Misc/NEWS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Python/ceval.c Fri Jan 29 19:06:00 2016 -0600
+++ b/Python/ceval.c Sun Jan 31 11:19:40 2016 +0000
@@ -4615,10 +4615,12 @@
PyObject *t = NULL;
t = PySequence_Tuple(stararg);
if (t == NULL) {
- if (PyErr_ExceptionMatches(PyExc_TypeError)) {
+ if (PyErr_ExceptionMatches(PyExc_TypeError) &&
+ /* Don't mask TypeError raised from a generator */
+ !PyGen_Check(stararg)) {
PyErr_Format(PyExc_TypeError,
"%.200s%.200s argument after * "
- "must be a sequence, not %200s",
+ "must be an iterable, not %200s",
PyEval_GetFuncName(func),
PyEval_GetFuncDesc(func),
stararg->ob_type->tp_name);
« no previous file with comments | « Misc/NEWS ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+