summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-01-31 06:33:16 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-01-31 06:33:16 (GMT)
commitcca32995b35aa9c371459e19caaa003d1e761b8a (patch)
tree4ce436cb6c552a3088fb3501519753852daff4c2 /Python/ceval.c
parent03178a5f7eb7af39b07ef43834c815ade6a394e6 (diff)
parentb5944220abaa525d326b6054b213adcdb26e7fda (diff)
downloadcpython-cca32995b35aa9c371459e19caaa003d1e761b8a.zip
cpython-cca32995b35aa9c371459e19caaa003d1e761b8a.tar.gz
cpython-cca32995b35aa9c371459e19caaa003d1e761b8a.tar.bz2
Issue #4806: Merge * unpacking fix from 3.5
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 3835cbb..743a969 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4999,16 +4999,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);