mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #27443: __length_hint__() of bytearray itearator no longer return
negative integer for resized bytearray.
This commit is contained in:
parent
8faca61fec
commit
af65872da2
3 changed files with 18 additions and 1 deletions
|
@ -3192,8 +3192,12 @@ static PyObject *
|
|||
bytearrayiter_length_hint(bytesiterobject *it)
|
||||
{
|
||||
Py_ssize_t len = 0;
|
||||
if (it->it_seq)
|
||||
if (it->it_seq) {
|
||||
len = PyByteArray_GET_SIZE(it->it_seq) - it->it_index;
|
||||
if (len < 0) {
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
return PyLong_FromSsize_t(len);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue