summaryrefslogtreecommitdiff
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index d69b8d6cc6..88dc1139eb 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4890,6 +4890,21 @@ update_star_args(int nstack, int nstar, PyObject *stararg,
{
PyObject *callargs, *w;
+ if (!nstack) {
+ if (!stararg) {
+ /* There are no positional arguments on the stack and there is no
+ sequence to be unpacked. */
+ return PyTuple_New(0);
+ }
+ if (PyTuple_CheckExact(stararg)) {
+ /* No arguments are passed on the stack and the sequence is not a
+ tuple subclass so we can just pass the stararg tuple directly
+ to the function. */
+ Py_INCREF(stararg);
+ return stararg;
+ }
+ }
+
callargs = PyTuple_New(nstack + nstar);
if (callargs == NULL) {
return NULL;