New submission from Jim Nasby:

In PyTuple_New, if the new tuple won't go on the free_list:

                /* Check for overflow */
                if (nbytes / sizeof(PyObject *) != (size_t)size ||
                    (nbytes > PY_SSIZE_T_MAX - sizeof(PyTupleObject) - 
sizeof(PyObject *)))
                {
                        return PyErr_NoMemory();
                }
                nbytes += sizeof(PyTupleObject) - sizeof(PyObject *);

nbytes is never used after the overflow check, so the last addition is a waste.

----------
messages: 254367
nosy: Jim Nasby
priority: normal
severity: normal
status: open
title: Useless addition in PyTuple_New
type: performance
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25587>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to