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
320b3915
Kaydet (Commit)
320b3915
authored
Ara 17, 2013
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20006: Fix sporadic failures in test_weakset.
üst
0c73fc04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
_weakrefset.py
Lib/_weakrefset.py
+2
-0
test_weakset.py
Lib/test/test_weakset.py
+6
-1
No files found.
Lib/_weakrefset.py
Dosyayı görüntüle @
320b3915
...
@@ -60,6 +60,8 @@ class WeakSet:
...
@@ -60,6 +60,8 @@ class WeakSet:
for
itemref
in
self
.
data
:
for
itemref
in
self
.
data
:
item
=
itemref
()
item
=
itemref
()
if
item
is
not
None
:
if
item
is
not
None
:
# Caveat: the iterator will keep a strong reference to
# `item` until it is resumed or closed.
yield
item
yield
item
def
__len__
(
self
):
def
__len__
(
self
):
...
...
Lib/test/test_weakset.py
Dosyayı görüntüle @
320b3915
...
@@ -370,9 +370,14 @@ class TestWeakSet(unittest.TestCase):
...
@@ -370,9 +370,14 @@ class TestWeakSet(unittest.TestCase):
def
testcontext
():
def
testcontext
():
try
:
try
:
it
=
iter
(
s
)
it
=
iter
(
s
)
next
(
it
)
# Start iterator
yielded
=
ustr
(
str
(
next
(
it
)))
# Schedule an item for removal and recreate it
# Schedule an item for removal and recreate it
u
=
ustr
(
str
(
items
.
pop
()))
u
=
ustr
(
str
(
items
.
pop
()))
if
yielded
==
u
:
# The iterator still has a reference to the removed item,
# advance it (issue #20006).
next
(
it
)
gc
.
collect
()
# just in case
gc
.
collect
()
# just in case
yield
u
yield
u
finally
:
finally
:
...
...
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