From: SourceForge.net <no...@so...> - 2007-07-30 04:09:59
|
Bugs item #1560858, was opened at 2006-09-18 11:14 Message generated for change (Comment added) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1560858&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Owen O\'Malley (owenomalley) Assigned to: Charles Groves (cgroves) Summary: range(long,long) doesn't work Initial Comment: The following program fails in jython 2.2a1: a = long(2)**32 range(a, a+1) with: TypeError: range(): 1st arg can't be coerced to int cPython gets it right: [4294967296L] ---------------------------------------------------------------------- >Comment By: Charles Groves (cgroves) Date: 2007-07-29 23:09 Message: Logged In: YES user_id=1174327 Originator: NO Fixed in r3366 as Leo mentioned in his first comment. This will still prevent stuff using range with a value greater than a Java long, but that's a bigger problem and we can let it wait until someone runs into it. ---------------------------------------------------------------------- Comment By: leouser (leouserz) Date: 2006-12-20 13:45 Message: Logged In: YES user_id=1277399 Originator: NO "Note: xrange() is intended to be simple and fast. Implementations may impose restrictions to achieve this. The C implementation of Python restricts all arguments to native C longs ("short" Python integers), and also requires that the number of elements fit in a native C long." from: http://docs.python.org/lib/built-in-funcs.html seems, that there are limits so it seems reasonable that xrange is doing the right thing. leouser ---------------------------------------------------------------------- Comment By: leouser (leouserz) Date: 2006-12-20 13:34 Message: Logged In: YES user_id=1277399 Originator: NO a first cut at a patch by converting the ints in __builtin__.range(....) to longs and replacing calls to py2int to py2long appears to solve the exception. There is always the possibility of Overflow which will probably need to be investigated. Oddly, xrange in python does not work with this value. I wonder if this is a bug in xrange and should be implemented to work in jython? leouser ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1560858&group_id=12867 |