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
2a48a6eb
Kaydet (Commit)
2a48a6eb
authored
Tem 05, 2015
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.3 (#24407)
üst
09e60588
a82f77fb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
7 deletions
+35
-7
test_dict.py
Lib/test/test_dict.py
+14
-0
NEWS
Misc/NEWS
+2
-0
dictobject.c
Objects/dictobject.c
+19
-7
No files found.
Lib/test/test_dict.py
Dosyayı görüntüle @
2a48a6eb
...
@@ -937,6 +937,20 @@ class DictTest(unittest.TestCase):
...
@@ -937,6 +937,20 @@ class DictTest(unittest.TestCase):
d
.
popitem
()
d
.
popitem
()
self
.
check_reentrant_insertion
(
mutate
)
self
.
check_reentrant_insertion
(
mutate
)
def
test_merge_and_mutate
(
self
):
class
X
:
def
__hash__
(
self
):
return
0
def
__eq__
(
self
,
o
):
other
.
clear
()
return
False
l
=
[(
i
,
0
)
for
i
in
range
(
1
,
1337
)]
other
=
dict
(
l
)
other
[
X
()]
=
0
d
=
{
X
():
0
,
1
:
1
}
self
.
assertRaises
(
RuntimeError
,
d
.
update
,
other
)
from
test
import
mapping_tests
from
test
import
mapping_tests
...
...
Misc/NEWS
Dosyayı görüntüle @
2a48a6eb
...
@@ -32,6 +32,8 @@ Core and Builtins
...
@@ -32,6 +32,8 @@ Core and Builtins
-
Issue
#
23757
:
PySequence_Tuple
()
incorrectly
called
the
concrete
list
API
-
Issue
#
23757
:
PySequence_Tuple
()
incorrectly
called
the
concrete
list
API
when
the
data
was
a
list
subclass
.
when
the
data
was
a
list
subclass
.
-
Issue
#
24407
:
Fix
crash
when
dict
is
mutated
while
being
updated
.
-
Issue
#
24096
:
Make
warnings
.
warn_explicit
more
robust
against
mutation
of
the
-
Issue
#
24096
:
Make
warnings
.
warn_explicit
more
robust
against
mutation
of
the
warnings
.
filters
list
.
warnings
.
filters
list
.
...
...
Objects/dictobject.c
Dosyayı görüntüle @
2a48a6eb
...
@@ -1973,23 +1973,35 @@ PyDict_Merge(PyObject *a, PyObject *b, int override)
...
@@ -1973,23 +1973,35 @@ PyDict_Merge(PyObject *a, PyObject *b, int override)
if
(
dictresize
(
mp
,
(
mp
->
ma_used
+
other
->
ma_used
)
*
2
)
!=
0
)
if
(
dictresize
(
mp
,
(
mp
->
ma_used
+
other
->
ma_used
)
*
2
)
!=
0
)
return
-
1
;
return
-
1
;
for
(
i
=
0
,
n
=
DK_SIZE
(
other
->
ma_keys
);
i
<
n
;
i
++
)
{
for
(
i
=
0
,
n
=
DK_SIZE
(
other
->
ma_keys
);
i
<
n
;
i
++
)
{
PyObject
*
value
;
PyObject
*
key
,
*
value
;
Py_hash_t
hash
;
entry
=
&
other
->
ma_keys
->
dk_entries
[
i
];
entry
=
&
other
->
ma_keys
->
dk_entries
[
i
];
key
=
entry
->
me_key
;
hash
=
entry
->
me_hash
;
if
(
other
->
ma_values
)
if
(
other
->
ma_values
)
value
=
other
->
ma_values
[
i
];
value
=
other
->
ma_values
[
i
];
else
else
value
=
entry
->
me_value
;
value
=
entry
->
me_value
;
if
(
value
!=
NULL
&&
if
(
value
!=
NULL
)
{
(
override
||
int
err
=
0
;
PyDict_GetItem
(
a
,
entry
->
me_key
)
==
NULL
))
{
Py_INCREF
(
key
);
if
(
insertdict
(
mp
,
entry
->
me_key
,
Py_INCREF
(
value
);
entry
->
me_hash
,
if
(
override
||
PyDict_GetItem
(
a
,
key
)
==
NULL
)
value
)
!=
0
)
err
=
insertdict
(
mp
,
key
,
hash
,
value
);
Py_DECREF
(
value
);
Py_DECREF
(
key
);
if
(
err
!=
0
)
return
-
1
;
if
(
n
!=
DK_SIZE
(
other
->
ma_keys
))
{
PyErr_SetString
(
PyExc_RuntimeError
,
"dict mutated during update"
);
return
-
1
;
return
-
1
;
}
}
}
}
}
}
}
else
{
else
{
/* Do it the generic, slower way */
/* Do it the generic, slower way */
PyObject
*
keys
=
PyMapping_Keys
(
b
);
PyObject
*
keys
=
PyMapping_Keys
(
b
);
...
...
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