Message263751
> 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. |
|
Date |
User |
Action |
Args |
2016-04-19 16:15:28 | llllllllll | set | recipients:
+ llllllllll, vstinner, martin.panter, serhiy.storchaka, yselivanov |
2016-04-19 16:15:28 | llllllllll | set | messageid: <1461082528.24.0.536721239091.issue26802@psf.upfronthosting.co.za> |
2016-04-19 16:15:28 | llllllllll | link | issue26802 messages |
2016-04-19 16:15:28 | llllllllll | create | |
|