[issue8259] left shift operator doesn't accepts long as second argument

Antoine Pitrou report at bugs.python.org
Mon Mar 29 16:55:30 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

I get another error on a 64-bit build:

>>> x = 2677691728509L << 2147483648L
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: outrageous left shift count

(yes, Python is outraged by such a large amount of left shifting)

The reason you get an OverflowError in 32-bit mode is that 2**31 is too large to be represented as a (signed) C long, rather than unsigned.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8259>
_______________________________________


More information about the Python-bugs-list mailing list