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

Side by Side 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 ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « Misc/NEWS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* Execute compiled code */ 2 /* Execute compiled code */
3 3
4 /* XXX TO DO: 4 /* XXX TO DO:
5 XXX speed up searching for keywords by using a dictionary 5 XXX speed up searching for keywords by using a dictionary
6 XXX document it! 6 XXX document it!
7 */ 7 */
8 8
9 /* enable more aggressive intra-module optimizations, where available */ 9 /* enable more aggressive intra-module optimizations, where available */
10 #define PY_LOCAL_AGGRESSIVE 10 #define PY_LOCAL_AGGRESSIVE
(...skipping 4597 matching lines...) Expand 10 before | Expand all | Expand 10 after
4608 Py_DECREF(kwdict); 4608 Py_DECREF(kwdict);
4609 kwdict = d; 4609 kwdict = d;
4610 } 4610 }
4611 } 4611 }
4612 if (flags & CALL_FLAG_VAR) { 4612 if (flags & CALL_FLAG_VAR) {
4613 stararg = EXT_POP(*pp_stack); 4613 stararg = EXT_POP(*pp_stack);
4614 if (!PyTuple_Check(stararg)) { 4614 if (!PyTuple_Check(stararg)) {
4615 PyObject *t = NULL; 4615 PyObject *t = NULL;
4616 t = PySequence_Tuple(stararg); 4616 t = PySequence_Tuple(stararg);
4617 if (t == NULL) { 4617 if (t == NULL) {
4618 if (PyErr_ExceptionMatches(PyExc_TypeError)) { 4618 if (PyErr_ExceptionMatches(PyExc_TypeError) &&
4619 /* Don't mask TypeError raised from a generator */
4620 !PyGen_Check(stararg)) {
4619 PyErr_Format(PyExc_TypeError, 4621 PyErr_Format(PyExc_TypeError,
4620 "%.200s%.200s argument after * " 4622 "%.200s%.200s argument after * "
4621 "must be a sequence, not %200s", 4623 "must be an iterable, not %200s",
4622 PyEval_GetFuncName(func), 4624 PyEval_GetFuncName(func),
4623 PyEval_GetFuncDesc(func), 4625 PyEval_GetFuncDesc(func),
4624 stararg->ob_type->tp_name); 4626 stararg->ob_type->tp_name);
4625 } 4627 }
4626 goto ext_call_fail; 4628 goto ext_call_fail;
4627 } 4629 }
4628 Py_DECREF(stararg); 4630 Py_DECREF(stararg);
4629 stararg = t; 4631 stararg = t;
4630 } 4632 }
4631 nstar = PyTuple_GET_SIZE(stararg); 4633 nstar = PyTuple_GET_SIZE(stararg);
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
5222 Py_DECREF(l); 5224 Py_DECREF(l);
5223 return NULL; 5225 return NULL;
5224 } 5226 }
5225 PyList_SetItem(l, i, x); 5227 PyList_SetItem(l, i, x);
5226 } 5228 }
5227 return l; 5229 return l;
5228 #endif 5230 #endif
5229 } 5231 }
5230 5232
5231 #endif 5233 #endif
OLDNEW
« 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+