[issue14794] slice.indices raises OverflowError

Mark Dickinson report at bugs.python.org
Sun Nov 4 11:37:02 CET 2012


Mark Dickinson added the comment:

Hmm:  one more thing that needs to be fixed before this can be committed---the error messages for maltyped start, stop and step are less informative than they used to be.

Before the patch:

    >>> slice(0, 2.3, 4).indices(5)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: slice indices must be integers or None or have an __index__ method

After the patch:

    >>> slice(0, 2.3, 4).indices(5)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'float' object cannot be interpreted as an integer

I'll fix this.

----------

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


More information about the Python-bugs-list mailing list