]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Make xrange more Py_ssize_t aware, by assuming a Py_ssize_t is always at
authorThomas Wouters <thomas@python.org>
Tue, 4 Apr 2006 17:28:12 +0000 (17:28 +0000)
committerThomas Wouters <thomas@python.org>
Tue, 4 Apr 2006 17:28:12 +0000 (17:28 +0000)
commitf4d8f390536416c083c687206be8e2687e26c9a3
tree4566f835f37272b4553cc60c8b393ac56ff0d13c
parent4aaaa49bacc59e4910fb929b7e6b641a1e66ca66
Make xrange more Py_ssize_t aware, by assuming a Py_ssize_t is always at
least as big as a long. I believe this to be a safe assumption that is being
made in many parts of CPython, but a check could be added.

len(xrange(sys.maxint)) works now, so fix the testsuite's odd exception for
64-bit platforms too. It also fixes 'zip(xrange(sys.maxint), it)' as a
portable-ish (if expensive) alternative to enumerate(it); since zip() now
calls len(), this was breaking on (real) 64-bit platforms. No additional
test was added for that behaviour.
Lib/test/test_xrange.py
Objects/rangeobject.c