[New-bugs-announce] [issue2804] Integer right shift raises OverflowError when second operand is large
Mark Dickinson
report at bugs.python.org
Fri May 9 20:17:56 CEST 2008
New submission from Mark Dickinson <dickinsm at gmail.com>:
In Python 2.6a3:
>>> 1 >> (2**31) # unexpected exception
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to int
>>> 1 >> (2**31-1) # works as expected
0L
It might make more sense for the first expression to return 0 instead.
Similarly, perhaps 0 << (2**31) should also return 0.
----------
components: Interpreter Core
messages: 66484
nosy: marketdickinson
severity: normal
status: open
title: Integer right shift raises OverflowError when second operand is large
type: behavior
versions: Python 2.6, Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2804>
__________________________________
More information about the New-bugs-announce
mailing list