Mark Dickinson <[email protected]> added the comment:
The original error, for a 32-bit machine, looks like expected behaviour to me;
at worst, it's a doc bug. If the right-hand argument doesn't fit into a
Py_ssize_t, then I think it's reasonable to refuse to do the shift.
But Antoine's 'outrageous left shift count' comes from the following code, in
long_lshift in Objects/longobject.c.
if ((long)(int)shiftby != shiftby) {
PyErr_SetString(PyExc_ValueError,
"outrageous left shift count");
goto lshift_error;
}
I think this code dates from the days when the number of 'digits' of a PyLong
was held in an int rather than a Py_ssize_t, and I think it's a (minor) bug. A
64-bit machine with sufficient RAM shouldn't mind shifting something by >=
2**31 places.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue8259>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com