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
b09ec9b6
Kaydet (Commit)
b09ec9b6
authored
Ock 25, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13454: Fix a crash when deleting an iterator created by itertools.tee()
if all other iterators were very advanced before.
üst
7ee79a28
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
test_itertools.py
Lib/test/test_itertools.py
+8
-0
NEWS
Misc/NEWS
+3
-0
itertoolsmodule.c
Modules/itertoolsmodule.c
+20
-1
No files found.
Lib/test/test_itertools.py
Dosyayı görüntüle @
b09ec9b6
...
@@ -906,6 +906,14 @@ class TestBasicOps(unittest.TestCase):
...
@@ -906,6 +906,14 @@ class TestBasicOps(unittest.TestCase):
del
a
del
a
self
.
assertRaises
(
ReferenceError
,
getattr
,
p
,
'__class__'
)
self
.
assertRaises
(
ReferenceError
,
getattr
,
p
,
'__class__'
)
# Issue 13454: Crash when deleting backward iterator from tee()
def
test_tee_del_backward
(
self
):
forward
,
backward
=
tee
(
xrange
(
20000000
))
for
i
in
forward
:
pass
del
backward
def
test_StopIteration
(
self
):
def
test_StopIteration
(
self
):
self
.
assertRaises
(
StopIteration
,
izip
()
.
next
)
self
.
assertRaises
(
StopIteration
,
izip
()
.
next
)
...
...
Misc/NEWS
Dosyayı görüntüle @
b09ec9b6
...
@@ -189,6 +189,9 @@ Core and Builtins
...
@@ -189,6 +189,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
13454
:
Fix
a
crash
when
deleting
an
iterator
created
by
itertools
.
tee
()
if
all
other
iterators
were
very
advanced
before
.
-
Issue
#
1159051
:
GzipFile
now
raises
EOFError
when
reading
a
corrupted
file
-
Issue
#
1159051
:
GzipFile
now
raises
EOFError
when
reading
a
corrupted
file
with
truncated
header
or
footer
.
with
truncated
header
or
footer
.
...
...
Modules/itertoolsmodule.c
Dosyayı görüntüle @
b09ec9b6
...
@@ -401,14 +401,31 @@ teedataobject_traverse(teedataobject *tdo, visitproc visit, void * arg)
...
@@ -401,14 +401,31 @@ teedataobject_traverse(teedataobject *tdo, visitproc visit, void * arg)
return
0
;
return
0
;
}
}
static
void
teedataobject_safe_decref
(
PyObject
*
obj
)
{
while
(
obj
&&
Py_TYPE
(
obj
)
==
&
teedataobject_type
&&
Py_REFCNT
(
obj
)
==
1
)
{
PyObject
*
nextlink
=
((
teedataobject
*
)
obj
)
->
nextlink
;
((
teedataobject
*
)
obj
)
->
nextlink
=
NULL
;
Py_DECREF
(
obj
);
obj
=
nextlink
;
}
Py_XDECREF
(
obj
);
}
static
int
static
int
teedataobject_clear
(
teedataobject
*
tdo
)
teedataobject_clear
(
teedataobject
*
tdo
)
{
{
int
i
;
int
i
;
PyObject
*
tmp
;
Py_CLEAR
(
tdo
->
it
);
Py_CLEAR
(
tdo
->
it
);
for
(
i
=
0
;
i
<
tdo
->
numread
;
i
++
)
for
(
i
=
0
;
i
<
tdo
->
numread
;
i
++
)
Py_CLEAR
(
tdo
->
values
[
i
]);
Py_CLEAR
(
tdo
->
values
[
i
]);
Py_CLEAR
(
tdo
->
nextlink
);
tmp
=
tdo
->
nextlink
;
tdo
->
nextlink
=
NULL
;
teedataobject_safe_decref
(
tmp
);
return
0
;
return
0
;
}
}
...
@@ -475,6 +492,8 @@ tee_next(teeobject *to)
...
@@ -475,6 +492,8 @@ tee_next(teeobject *to)
if
(
to
->
index
>=
LINKCELLS
)
{
if
(
to
->
index
>=
LINKCELLS
)
{
link
=
teedataobject_jumplink
(
to
->
dataobj
);
link
=
teedataobject_jumplink
(
to
->
dataobj
);
if
(
link
==
NULL
)
return
NULL
;
Py_DECREF
(
to
->
dataobj
);
Py_DECREF
(
to
->
dataobj
);
to
->
dataobj
=
(
teedataobject
*
)
link
;
to
->
dataobj
=
(
teedataobject
*
)
link
;
to
->
index
=
0
;
to
->
index
=
0
;
...
...
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