[New-bugs-announce] [issue27443] __length_hint__() of bytearray iterator can return negative integer

Serhiy Storchaka report at bugs.python.org
Sat Jul 2 15:53:54 EDT 2016


New submission from Serhiy Storchaka:

>>> ba = bytearray(b'ab')
>>> it = iter(ba)
>>> next(it)
97
>>> ba.clear()
>>> list(it)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: __length_hint__() should return >= 0

Proposed patch fixes this issue.

----------
components: Interpreter Core
files: bytearray_iterator_length_hint.patch
keywords: patch
messages: 269729
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: __length_hint__() of bytearray iterator can return negative integer
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43612/bytearray_iterator_length_hint.patch

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


More information about the New-bugs-announce mailing list