diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-01-31 06:30:56 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-01-31 06:30:56 (GMT) |
commit | 0bb165ecc114fcf7ce1df454355c4cbbef8b63e9 (patch) | |
tree | 4e03ad7e9e730183126490418f54fa4e3a149630 /Python/ceval.c | |
parent | 414f8b937f1ccab9a493b387fa42529416ea1a08 (diff) | |
download | cpython-0bb165ecc114fcf7ce1df454355c4cbbef8b63e9.zip cpython-0bb165ecc114fcf7ce1df454355c4cbbef8b63e9.tar.gz cpython-0bb165ecc114fcf7ce1df454355c4cbbef8b63e9.tar.bz2 |
Issue #4806: Avoid masking TypeError when *-unpacking a generator
Based on patch by Hagen Fürstenau.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 6e5e272..0b747d8 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4615,10 +4615,12 @@ ext_do_call(PyObject *func, PyObject ***pp_stack, int flags, int na, int nk) 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); |