Message289654
| Author |
serhiy.storchaka |
| Recipients |
Oren Milman, mark.dickinson, serhiy.storchaka, vstinner |
| Date |
2017年03月15日.09:19:13 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1489569553.43.0.979807612604.issue29816@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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. |
|
History
|
|---|
| 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 |
|