[Patches] [ python-Patches-1472639 ] make range be xrange

SourceForge.net noreply at sourceforge.net
Tue Feb 27 06:18:10 CET 2007


Patches item #1472639, was opened at 2006-04-18 15:40
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1472639&group_id=5470

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 (C code)
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Thomas Wouters (twouters)
Assigned to: Neal Norwitz (nnorwitz)
Summary: make range be xrange

Initial Comment:
As discussed (in private email), make range an alias
for xrange and see howmuch breaks ;)

Aside from Python/bltinmodule.c, 31 files had to be
changed: 3 modules (but one of them was a doctest in
doctest), 2 test output files (for profile and
cProfile), and 26 tests. The predominant breakage in
tests was due to tests using range() to express
expected-test-output, and comparing it with the output
list. Another fair sized portion (particularly of
doctests, and including the doctest in doctest itself
that had to be updated) broke because of reliance on
the repr of range(). Only a few tests broke because of
xrange() being immutable (mostly tests that were
actually testing list-behaviour, like item- and
slice-assignment, on a list created by range()), but
that were all two real breakages in actual modules. The
only place that broke because xrange can't handle longs
was the test for range() that tested whether it'd take
longs. Overall, ~185 lines had to be changed.

The patch still breaks a test: the test to see if
range() does proper checks on its arguments (using the
'badint' class in test_builtin.) I didn't fix it to
remind myself that xrange() should be made to operate
on longs :) (It currently fails because xrange() will
turn all its arguments into C long integers before it
does any checks.)


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-02-26 21:18

Message:
Logged In: YES 
user_id=33168
Originator: NO

Updating a checkpoint which patches everything in the library.  Also has a
non-working version of xrange.  I haven't ported this from 2.6 to the
int/long unification.  This is just in case my laptop crashes.  Hopefully
I'll finish this up tomorrow and check in.

Most of the tests pass.  There are only a few issues AFAIK, like
test_xrange (big surprise) and test_repr.  Basically the longs aren't done.
 I'm not sure about floats.  Floats should be rejected in 3k.
File Added: xrange.diff

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2006-12-27 17:39

Message:
Logged In: YES 
user_id=6380
Originator: NO

Ping?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2006-08-26 13:20

Message:
Logged In: YES 
user_id=6380

For Neal to close when his range/xrange patch is uploaded.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1472639&group_id=5470


More information about the Patches mailing list