Joe Jevnik added the comment:
> It's possible that stararg is already an empty tuple. Is it worth to use it?
PyTuple_New(0) should return the unit tuple in most cases:
#if PyTuple_MAXSAVESIZE > 0
if (size == 0 && free_list[0]) {
op = free_list[0];
Py_INCREF(op);
#ifdef COUNT_ALLOCS
tuple_zero_allocs++;
#endif
return (PyObject *) op;
}
Looking at this again I think that checking if stararg is nonnull is more
clear, I will update the patch (as call-function-var-3.patch). I cannot exactly
rewrite the if to use the control flow you show because that would cause
non-tuple subclasses to forward a stararg of () instead of copying it into a
normal tuple when no arguments are passed ont the stack.
----------
Added file: http://bugs.python.org/file42521/call-function-var-3.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26802>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com