This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author owirj
Recipients owirj
Date 2010-03-29.12:29:19
SpamBayes Score 1.4663698e-10
Marked as misclassified No
Message-id <1269865762.04.0.794045726086.issue8259@psf.upfronthosting.co.za>
In-reply-to
Content
python -V:
Python 2.6.5

Executing on 32-bit machine.

From documentation ( http://docs.python.org/reference/expressions.html ), "5.7. Shifting operations":
"These operators accept plain or long integers as arguments. The arguments are converted to a common type. They shift the first argument to the left or right by the number of bits given by the second argument."

In interpreter:
>>> x = 2677691728509L << 2147483648L
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to int

hint: 2147483648 = (1 << 31)

First argument is long, second is long too, so expected behavior was normal execution. But as seen from the code above interpreter gives overflow error. Looks like he tries to convert second argument to int type, because this code works gracefully:
>>> x = 2677691728509L << 2147483647L
History
Date User Action Args
2010-03-29 12:29:22owirjsetrecipients: + owirj
2010-03-29 12:29:22owirjsetmessageid: <1269865762.04.0.794045726086.issue8259@psf.upfronthosting.co.za>
2010-03-29 12:29:20owirjlinkissue8259 messages
2010-03-29 12:29:19owirjcreate