Author serhiy.storchaka
Recipients Oren Milman, haypo, mark.dickinson, serhiy.storchaka
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:13serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson, haypo, Oren Milman
2017-03-15 09:19:13serhiy.storchakasetmessageid: <1489569553.43.0.979807612604.issue29816@psf.upfronthosting.co.za>
2017-03-15 09:19:13serhiy.storchakalinkissue29816 messages
2017-03-15 09:19:13serhiy.storchakacreate