This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients mark.dickinson, martin.panter, r.david.murray, rhettinger, serhiy.storchaka, tim.peters, xiang.zhang
Date 2016-08-02.06:10:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1470118256.57.0.350709739082.issue27660@psf.upfronthosting.co.za>
In-reply-to
Content
Unsigned type can be used for more efficient checking on integer overflow.

    new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6);
    new_allocated += (size_t)newsize;
    if (new_allocated < (size_t)newsize) {
        PyErr_NoMemory();
        return -1;
    }

Checking "new_allocated < (size_t)newsize" can be more efficient than "new_allocated > PY_SSIZE_T_MAX - newsize".
History
Date User Action Args
2016-08-02 06:10:56serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, r.david.murray, martin.panter, xiang.zhang
2016-08-02 06:10:56serhiy.storchakasetmessageid: <1470118256.57.0.350709739082.issue27660@psf.upfronthosting.co.za>
2016-08-02 06:10:56serhiy.storchakalinkissue27660 messages
2016-08-02 06:10:56serhiy.storchakacreate