[New-bugs-announce] [issue10889] Fix range slicing and indexing to handle lengths > sys.maxsize

Nick Coghlan report at bugs.python.org
Tue Jan 11 16:59:29 CET 2011


New submission from Nick Coghlan <ncoghlan at gmail.com>:

Enhancement to range to correctly handle indexing and slicing when len(x) raises OverflowError.

Note that this enables correct calculation of the length of such ranges via:

        def _range_len(x):
            try:
                length = len(x)
            except OverflowError:
                step = x[1] - x[0]
                length = 1 + ((x[-1] - x[0]) // step)
            return length

----------
assignee: ncoghlan
messages: 126017
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Fix range slicing and indexing to handle lengths > sys.maxsize

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10889>
_______________________________________


More information about the New-bugs-announce mailing list