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
e62a694f
Kaydet (Commit)
e62a694f
authored
Eyl 08, 2016
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26020: Fix evaluation order for set literals
üst
cb20a217
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
test_set.py
Lib/test/test_set.py
+15
-0
ceval.c
Python/ceval.c
+4
-2
No files found.
Lib/test/test_set.py
Dosyayı görüntüle @
e62a694f
...
...
@@ -360,6 +360,21 @@ class TestSet(TestJointOps):
t
=
self
.
thetype
(
s
)
self
.
assertNotEqual
(
id
(
s
),
id
(
t
))
def
test_set_literal_insertion_order
(
self
):
# SF Issue #26020 -- Expect left to right insertion
s
=
{
1
,
1.0
,
True
}
self
.
assertEqual
(
len
(
s
),
1
)
stored_value
=
s
.
pop
()
self
.
assertEqual
(
type
(
stored_value
),
int
)
def
test_set_literal_evaluation_order
(
self
):
# Expect left to right expression evaluation
events
=
[]
def
record
(
obj
):
events
.
append
(
obj
)
s
=
{
record
(
1
),
record
(
2
),
record
(
3
)}
self
.
assertEqual
(
events
,
[
1
,
2
,
3
])
def
test_hash
(
self
):
self
.
assertRaises
(
TypeError
,
hash
,
self
.
s
)
...
...
Python/ceval.c
Dosyayı görüntüle @
e62a694f
...
...
@@ -2477,14 +2477,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
TARGET
(
BUILD_SET
)
{
int
i
;
x
=
PySet_New
(
NULL
);
if
(
x
!=
NULL
)
{
for
(
;
--
oparg
>=
0
;
)
{
w
=
P
OP
(
);
for
(
i
=
oparg
;
i
>
0
;
i
--
)
{
w
=
P
EEK
(
i
);
if
(
err
==
0
)
err
=
PySet_Add
(
x
,
w
);
Py_DECREF
(
w
);
}
STACKADJ
(
-
oparg
);
if
(
err
!=
0
)
{
Py_DECREF
(
x
);
break
;
...
...
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