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
06aed90a
Kaydet (Commit)
06aed90a
authored
Eyl 09, 2016
tarafından
Eric Snow
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27576: Fix call order in OrderedDict.__init__().
üst
7d895ac9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
test_ordered_dict.py
Lib/test/test_ordered_dict.py
+13
-0
NEWS
Misc/NEWS
+2
-0
odictobject.c
Objects/odictobject.c
+15
-2
No files found.
Lib/test/test_ordered_dict.py
Dosyayı görüntüle @
06aed90a
...
@@ -98,6 +98,19 @@ class OrderedDictTests:
...
@@ -98,6 +98,19 @@ class OrderedDictTests:
self
.
assertRaises
(
TypeError
,
OrderedDict
()
.
update
,
(),
())
self
.
assertRaises
(
TypeError
,
OrderedDict
()
.
update
,
(),
())
self
.
assertRaises
(
TypeError
,
OrderedDict
.
update
)
self
.
assertRaises
(
TypeError
,
OrderedDict
.
update
)
def
test_init_calls
(
self
):
calls
=
[]
class
Spam
:
def
keys
(
self
):
calls
.
append
(
'keys'
)
return
()
def
items
(
self
):
calls
.
append
(
'items'
)
return
()
self
.
OrderedDict
(
Spam
())
self
.
assertEqual
(
calls
,
[
'keys'
])
def
test_fromkeys
(
self
):
def
test_fromkeys
(
self
):
OrderedDict
=
self
.
OrderedDict
OrderedDict
=
self
.
OrderedDict
od
=
OrderedDict
.
fromkeys
(
'abc'
)
od
=
OrderedDict
.
fromkeys
(
'abc'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
06aed90a
...
@@ -113,6 +113,8 @@ Core and Builtins
...
@@ -113,6 +113,8 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
27576
:
Fix
call
order
in
OrderedDict
.
__init__
().
-
email
.
generator
.
DecodedGenerator
now
supports
the
policy
keyword
.
-
email
.
generator
.
DecodedGenerator
now
supports
the
policy
keyword
.
-
Issue
#
28027
:
Remove
undocumented
modules
from
``
Lib
/
plat
-*``:
IN
,
CDROM
,
-
Issue
#
28027
:
Remove
undocumented
modules
from
``
Lib
/
plat
-*``:
IN
,
CDROM
,
...
...
Objects/odictobject.c
Dosyayı görüntüle @
06aed90a
...
@@ -2356,8 +2356,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
...
@@ -2356,8 +2356,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
PyObject
*
other
=
PyTuple_GET_ITEM
(
args
,
0
);
/* borrowed reference */
PyObject
*
other
=
PyTuple_GET_ITEM
(
args
,
0
);
/* borrowed reference */
assert
(
other
!=
NULL
);
assert
(
other
!=
NULL
);
Py_INCREF
(
other
);
Py_INCREF
(
other
);
if
(
PyDict_CheckExact
(
other
)
||
if
PyDict_CheckExact
(
other
)
{
_PyObject_HasAttrId
(
other
,
&
PyId_items
))
{
/* never fails */
PyObject
*
items
;
PyObject
*
items
;
if
(
PyDict_CheckExact
(
other
))
if
(
PyDict_CheckExact
(
other
))
items
=
PyDict_Items
(
other
);
items
=
PyDict_Items
(
other
);
...
@@ -2400,6 +2399,20 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
...
@@ -2400,6 +2399,20 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
if
(
res
!=
0
||
PyErr_Occurred
())
if
(
res
!=
0
||
PyErr_Occurred
())
return
NULL
;
return
NULL
;
}
}
else
if
(
_PyObject_HasAttrId
(
other
,
&
PyId_items
))
{
/* never fails */
PyObject
*
items
;
if
(
PyDict_CheckExact
(
other
))
items
=
PyDict_Items
(
other
);
else
items
=
_PyObject_CallMethodId
(
other
,
&
PyId_items
,
NULL
);
Py_DECREF
(
other
);
if
(
items
==
NULL
)
return
NULL
;
res
=
mutablemapping_add_pairs
(
self
,
items
);
Py_DECREF
(
items
);
if
(
res
==
-
1
)
return
NULL
;
}
else
{
else
{
res
=
mutablemapping_add_pairs
(
self
,
other
);
res
=
mutablemapping_add_pairs
(
self
,
other
);
Py_DECREF
(
other
);
Py_DECREF
(
other
);
...
...
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