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

2010-04-06 Thread Mark Dickinson
Mark Dickinson added the comment: By the way, this has nothing to do with int versus long (unless I'm misunderstanding the original issue); it's simply that large shift counts cause an OverflowError. I've added a note about this to the docs in r79852. -- resolution: -> fixed status

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

2010-04-06 Thread Mark Dickinson
Mark Dickinson added the comment: Patch applied in r79843 (and added forgotten Misc/NEWS entry in r79844); merged to py3k in r79845. -- assignee: mark.dickinson -> type: -> feature request ___ Python tracker __

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

2010-04-06 Thread Mark Dickinson
Mark Dickinson added the comment: Patch that unoutrages Python attached: it allows shift counts of up to sys.maxsize in both left shift and right shift. I don't have a test for this, since the only tests I can think of (e.g. actually doing 1 << (2**31)) require > 270Mb of RAM, and that may

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

2010-04-02 Thread Mark Dickinson
Mark Dickinson 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 c

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

2010-03-29 Thread owirj
owirj added the comment: Antoine Pitrou: 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. I understand that, but after reading documentation, was expecting it to convert second argument to long type, wh

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

2010-03-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: I get another error on a 64-bit build: >>> x = 2677691728509L << 2147483648L Traceback (most recent call last): File "", line 1, in ValueError: outrageous left shift count (yes, Python is outraged by such a large amount of left shifting) The reason you get

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

2010-03-29 Thread R. David Murray
R. David Murray added the comment: This appears to be working as designed, and so is probably a doc issue. Python 3, which only has one integer type, has the same behavior: >>> x = 2677691728509 << 2147483648 Traceback (most recent call last): File "", line 1, in OverflowError: Python int

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

2010-03-29 Thread owirj
New submission from owirj : 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. T