summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 786adbf..aee0e6b 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4935,16 +4935,18 @@ ext_do_call(PyObject *func, PyObject ***pp_stack, int flags, int na, int nk)
stararg = EXT_POP(*pp_stack);
if (!PyTuple_Check(stararg)) {
PyObject *t = NULL;
+ if (Py_TYPE(stararg)->tp_iter == NULL &&
+ !PySequence_Check(stararg)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s%.200s argument after * "
+ "must be an iterable, not %.200s",
+ PyEval_GetFuncName(func),
+ PyEval_GetFuncDesc(func),
+ stararg->ob_type->tp_name);
+ goto ext_call_fail;
+ }
t = PySequence_Tuple(stararg);
if (t == NULL) {
- if (PyErr_ExceptionMatches(PyExc_TypeError)) {
- PyErr_Format(PyExc_TypeError,
- "%.200s%.200s argument after * "
- "must be a sequence, not %.200s",
- PyEval_GetFuncName(func),
- PyEval_GetFuncDesc(func),
- stararg->ob_type->tp_name);
- }
goto ext_call_fail;
}
Py_DECREF(stararg);