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
66c4a6b5
Kaydet (Commit)
66c4a6b5
authored
Nis 01, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
üst
449b7d95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
_abcoll.py
Lib/_abcoll.py
+3
-4
test_collections.py
Lib/test/test_collections.py
+25
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/_abcoll.py
Dosyayı görüntüle @
66c4a6b5
...
...
@@ -286,10 +286,9 @@ class MutableSet(Set):
self
.
add
(
value
)
return
self
def
__iand__
(
self
,
c
):
for
value
in
self
:
if
value
not
in
c
:
self
.
discard
(
value
)
def
__iand__
(
self
,
it
):
for
value
in
(
self
-
it
):
self
.
discard
(
value
)
return
self
def
__ixor__
(
self
,
it
):
...
...
Lib/test/test_collections.py
Dosyayı görüntüle @
66c4a6b5
...
...
@@ -327,6 +327,25 @@ class TestOneTrickPonyABCs(ABCTestCase):
B
.
register
(
C
)
self
.
failUnless
(
issubclass
(
C
,
B
))
class
WithSet
(
MutableSet
):
def
__init__
(
self
,
it
=
()):
self
.
data
=
set
(
it
)
def
__len__
(
self
):
return
len
(
self
.
data
)
def
__iter__
(
self
):
return
iter
(
self
.
data
)
def
__contains__
(
self
,
item
):
return
item
in
self
.
data
def
add
(
self
,
item
):
self
.
data
.
add
(
item
)
def
discard
(
self
,
item
):
self
.
data
.
discard
(
item
)
class
TestCollectionABCs
(
ABCTestCase
):
...
...
@@ -363,6 +382,12 @@ class TestCollectionABCs(ABCTestCase):
self
.
validate_abstract_methods
(
MutableSet
,
'__contains__'
,
'__iter__'
,
'__len__'
,
'add'
,
'discard'
)
def
test_issue_5647
(
self
):
# MutableSet.__iand__ mutated the set during iteration
s
=
WithSet
(
'abcd'
)
s
&=
WithSet
(
'cdef'
)
# This used to fail
self
.
assertEqual
(
set
(
s
),
set
(
'cd'
))
def
test_issue_4920
(
self
):
# MutableSet.pop() method did not work
class
MySet
(
collections
.
MutableSet
):
...
...
Misc/NEWS
Dosyayı görüntüle @
66c4a6b5
...
...
@@ -206,6 +206,8 @@ Library
instead of performing them in functions. Helps prevent import deadlocking in
threads.
- Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
- Actually make the SimpleXMLRPCServer CGI handler work.
- Issue #2522: locale.format now checks its first argument to ensure it has
...
...
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