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
ab30353a
Kaydet (Commit)
ab30353a
authored
Tem 05, 2015
tarafından
Larry Hastings
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge with ongoing work in 3.5 branch.
üst
b34db6ad
95f9dd5e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
14 deletions
+50
-14
test_dict.py
Lib/test/test_dict.py
+14
-0
test_unpack_ex.py
Lib/test/test_unpack_ex.py
+3
-0
NEWS
Misc/NEWS
+4
-0
dictobject.c
Objects/dictobject.c
+19
-7
ceval.c
Python/ceval.c
+9
-6
msi.targets
Tools/msi/msi.targets
+1
-1
No files found.
Lib/test/test_dict.py
Dosyayı görüntüle @
ab30353a
...
...
@@ -937,6 +937,20 @@ class DictTest(unittest.TestCase):
d
.
popitem
()
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
...
...
Lib/test/test_unpack_ex.py
Dosyayı görüntüle @
ab30353a
...
...
@@ -128,6 +128,9 @@ Dict display element unpacking
... for i in range(1000)) + "}"))
1000
>>> {0:1, **{0:2}, 0:3, 0:4}
{0: 4}
List comprehension element unpacking
>>> a, b, c = [0, 1, 2], 3, 4
...
...
Misc/NEWS
Dosyayı görüntüle @
ab30353a
...
...
@@ -10,6 +10,10 @@ Release date: 2015-07-26
Core and Builtins
-----------------
- Issue #24569: Make PEP 448 dictionary evaluation more consistent.
- Issue #24407: Fix crash when dict is mutated while being updated.
Library
-------
...
...
Objects/dictobject.c
Dosyayı görüntüle @
ab30353a
...
...
@@ -2039,20 +2039,32 @@ PyDict_Merge(PyObject *a, PyObject *b, int override)
if
(
dictresize
(
mp
,
(
mp
->
ma_used
+
other
->
ma_used
)
*
2
)
!=
0
)
return
-
1
;
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
];
key
=
entry
->
me_key
;
hash
=
entry
->
me_hash
;
if
(
other
->
ma_values
)
value
=
other
->
ma_values
[
i
];
else
value
=
entry
->
me_value
;
if
(
value
!=
NULL
&&
(
override
||
PyDict_GetItem
(
a
,
entry
->
me_key
)
==
NULL
))
{
if
(
insertdict
(
mp
,
entry
->
me_key
,
entry
->
me_hash
,
value
)
!=
0
)
if
(
value
!=
NULL
)
{
int
err
=
0
;
Py_INCREF
(
key
);
Py_INCREF
(
value
);
if
(
override
||
PyDict_GetItem
(
a
,
key
)
==
NULL
)
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
;
}
}
}
}
...
...
Python/ceval.c
Dosyayı görüntüle @
ab30353a
...
...
@@ -2561,22 +2561,25 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
}
TARGET
(
BUILD_MAP
)
{
int
i
;
PyObject
*
map
=
_PyDict_NewPresized
((
Py_ssize_t
)
oparg
);
if
(
map
==
NULL
)
goto
error
;
while
(
--
oparg
>=
0
)
{
for
(
i
=
oparg
;
i
>
0
;
i
--
)
{
int
err
;
PyObject
*
value
=
TOP
();
PyObject
*
key
=
SECOND
();
STACKADJ
(
-
2
);
PyObject
*
key
=
PEEK
(
2
*
i
);
PyObject
*
value
=
PEEK
(
2
*
i
-
1
);
err
=
PyDict_SetItem
(
map
,
key
,
value
);
Py_DECREF
(
value
);
Py_DECREF
(
key
);
if
(
err
!=
0
)
{
Py_DECREF
(
map
);
goto
error
;
}
}
while
(
oparg
--
)
{
Py_DECREF
(
POP
());
Py_DECREF
(
POP
());
}
PUSH
(
map
);
DISPATCH
();
}
...
...
Tools/msi/msi.targets
Dosyayı görüntüle @
ab30353a
...
...
@@ -24,7 +24,7 @@
</ItemGroup>
</Target>
<Target
Name=
"_TransformWxlTemplates"
AfterTargets=
"PrepareForBuild"
>
<Target
Name=
"_TransformWxlTemplates"
AfterTargets=
"PrepareForBuild"
Inputs=
"@(WxlTemplate);$(PySourcePath)include\patchlevel.h"
Outputs=
"$(IntermediateOutputPath)%(Filename).wxl"
>
<PropertyGroup>
<_Content>
$([System.IO.File]::ReadAllText(%(WxlTemplate.FullPath)).Replace(`{{ShortVersion}}`, `$(MajorVersionNumber).$(MinorVersionNumber)`).Replace(`{{LongVersion}}`, `$(PythonVersion)`).Replace(`{{Bitness}}`, `$(Bitness)`))
</_Content>
<_ExistingContent
Condition=
"Exists('$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl')"
>
$([System.IO.File]::ReadAllText($(IntermediateOutputPath)%(WxlTemplate.Filename).wxl))
</_ExistingContent>
...
...
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