Skip to content

Commit 9458120

Browse files
committed
Validate that the result is a tuple.
1 parent f8d9cb1 commit 9458120

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Objects/genericaliasobject.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,14 @@ _Py_subs_parameters(PyObject *self, PyObject *args, PyObject *parameters, PyObje
525525
return NULL;
526526
}
527527
if (unpack) {
528+
if (!PyTuple_Check(arg)) {
529+
Py_DECREF(newargs);
530+
Py_DECREF(item);
531+
Py_XDECREF(tuple_args);
532+
PyErr_Format(PyExc_TypeError,
533+
"expected a tuple, not %T", arg);
534+
return NULL;
535+
}
528536
jarg = tuple_extend(&newargs, jarg,
529537
&PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg));
530538
Py_DECREF(arg);

0 commit comments

Comments
 (0)