mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Issue #4806: Avoid masking TypeError when *-unpacking a generator
Based on patch by Hagen Fürstenau.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user