Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
af65872d
Kaydet (Commit)
af65872d
authored
Tem 03, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27443: __length_hint__() of bytearray itearator no longer return
negative integer for resized bytearray.
üst
8faca61f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
test_bytes.py
Lib/test/test_bytes.py
+10
-0
NEWS
Misc/NEWS
+3
-0
bytearrayobject.c
Objects/bytearrayobject.c
+5
-1
No files found.
Lib/test/test_bytes.py
Dosyayı görüntüle @
af65872d
...
...
@@ -1233,6 +1233,16 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
test_exhausted_iterator
=
test
.
list_tests
.
CommonTest
.
test_exhausted_iterator
def
test_iterator_length_hint
(
self
):
# Issue 27443: __length_hint__ can return negative integer
ba
=
bytearray
(
b
'ab'
)
it
=
iter
(
ba
)
next
(
it
)
ba
.
clear
()
# Shouldn't raise an error
self
.
assertEqual
(
list
(
it
),
[])
class
AssortedBytesTest
(
unittest
.
TestCase
):
#
# Test various combinations of bytes and bytearray
...
...
Misc/NEWS
Dosyayı görüntüle @
af65872d
...
...
@@ -10,6 +10,9 @@ Release date: TBA
Core and Builtins
-----------------
- Issue #27443: __length_hint__() of bytearray itearator no longer return
negative integer for resized bytearray.
Library
-------
...
...
Objects/bytearrayobject.c
Dosyayı görüntüle @
af65872d
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment