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 martin.panter
Recipients martin.panter, serhiy.storchaka, xiang.zhang
Date 2016-07-23.06:02:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469253764.52.0.0115221664258.issue27581@psf.upfronthosting.co.za>
In-reply-to
Content
Hmm maybe this patch is okay. We are assuming size_t will fit more than PY_SSIZE_T_MAX.

The alternatives I can think of would be equally ugly:

/* Risks loss of precision, e.g. 64 bit integer from floating point */
if (n < (Py_ssize_t)(PY_SSIZE_T_MAX / 1.25) - 10))

/* PY_SSIZE_T_MAX * 4/5 - 10 without loss of precision or overflowing */
if (n < PY_SSIZE_T_MAX / 5 * 4 + PY_SSIZE_T_MAX % 5 * 4 / 5 - 10)
History
Date User Action Args
2016-07-23 06:02:44martin.pantersetrecipients: + martin.panter, serhiy.storchaka, xiang.zhang
2016-07-23 06:02:44martin.pantersetmessageid: <1469253764.52.0.0115221664258.issue27581@psf.upfronthosting.co.za>
2016-07-23 06:02:44martin.panterlinkissue27581 messages
2016-07-23 06:02:44martin.pantercreate