summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 7d4543e..20d0e1c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5532,7 +5532,13 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func,
/* Pack other positional arguments into the *args argument */
if (co->co_flags & CO_VARARGS) {
PyObject *u = NULL;
- u = _PyTuple_FromArraySteal(args + n, argcount - n);
+ if (argcount == n) {
+ u = Py_NewRef(&_Py_SINGLETON(tuple_empty));
+ }
+ else {
+ assert(args != NULL);
+ u = _PyTuple_FromArraySteal(args + n, argcount - n);
+ }
if (u == NULL) {
goto fail_post_positional;
}