[New-bugs-announce] [issue16402] range slicing swallows exceptions from __index__ methods.

Mark Dickinson report at bugs.python.org
Sun Nov 4 12:27:44 CET 2012


New submission from Mark Dickinson:

>>> class A(object):
...     def __index__(self): raise ZeroDivisionError
... 
[66062 refs]
>>> a = A()
[66065 refs]
>>> range(10)[0:a]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
[66105 refs]

----------
assignee: mark.dickinson
messages: 174782
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: range slicing swallows exceptions from __index__ methods.

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


More information about the New-bugs-announce mailing list