Message271062
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) |
|
Date |
User |
Action |
Args |
2016-07-23 06:02:44 | martin.panter | set | recipients:
+ martin.panter, serhiy.storchaka, xiang.zhang |
2016-07-23 06:02:44 | martin.panter | set | messageid: <1469253764.52.0.0115221664258.issue27581@psf.upfronthosting.co.za> |
2016-07-23 06:02:44 | martin.panter | link | issue27581 messages |
2016-07-23 06:02:44 | martin.panter | create | |
|