[New-bugs-announce] [issue12381] bytearray methods count, find, index don't support None as in slice notation

py.user report at bugs.python.org
Tue Jun 21 05:57:17 CEST 2011


New submission from py.user <port139 at yandex.ru>:

>>> bytearray(b'abc').count(bytearray(b''), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
>>> bytearray(b'abc').find(bytearray(b''), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
>>> bytearray(b'abc').index(bytearray(b''), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method


and duplicate issues (endswith and startswith):

>>> bytearray(b'abc').endswith(bytearray(b''), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
>>> bytearray(b'abc').startswith(bytearray(b''), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
>>>

----------
components: Interpreter Core
messages: 138770
nosy: py.user
priority: normal
severity: normal
status: open
title: bytearray methods count, find, index don't support None as in slice notation
type: behavior
versions: Python 2.7, Python 3.1

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


More information about the New-bugs-announce mailing list