Message289654
> If we change something, I suggest to be consistent with lshift. I expect a memory error on "1 << (1 << 1024)" (no unlimited loop before a global system collapse please ;-))
I agree that left shift should raise an ValueError rather than OverflowError for large negative shifts. But is hard to handle large positive shifts. `1 << count` consumes `count*2/15` bytes of memory. There is a gap between the maximal value of bits represented as Py_ssize_t (PY_SSIZE_T_MAX) and the number of bits of maximal Python int (PY_SSIZE_T_MAX*15/2). _PyLong_NumBits() starves from the same issue. I think an OverflowError is appropriate here for denoting the platform and implementation limitation. |
|
Date |
User |
Action |
Args |
2017-03-15 09:19:13 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, mark.dickinson, vstinner, Oren Milman |
2017-03-15 09:19:13 | serhiy.storchaka | set | messageid: <1489569553.43.0.979807612604.issue29816@psf.upfronthosting.co.za> |
2017-03-15 09:19:13 | serhiy.storchaka | link | issue29816 messages |
2017-03-15 09:19:13 | serhiy.storchaka | create | |
|