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
0718de97
Kaydet (Commit)
0718de97
authored
Haz 07, 2015
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
repair my irrational excuberance
üst
99e96f2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
54 deletions
+57
-54
odictobject.c
Objects/odictobject.c
+57
-54
No files found.
Objects/odictobject.c
Dosyayı görüntüle @
0718de97
...
...
@@ -2411,73 +2411,76 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
return
NULL
;
}
PyObject
*
other
=
PyTuple_GET_ITEM
(
args
,
0
);
/* borrowed reference */
if
(
other
==
NULL
)
return
NULL
;
Py_INCREF
(
other
);
if
(
PyObject_HasAttrString
(
other
,
"items"
))
{
/* never fails */
PyObject
*
items
=
PyMapping_Items
(
other
);
Py_DECREF
(
other
);
if
(
items
==
NULL
)
return
NULL
;
res
=
mutablemapping_add_pairs
(
self
,
items
);
Py_DECREF
(
items
);
if
(
res
==
-
1
)
if
(
len
==
1
)
{
PyObject
*
other
=
PyTuple_GET_ITEM
(
args
,
0
);
/* borrowed reference */
if
(
other
==
NULL
)
return
NULL
;
}
else
if
(
PyObject_HasAttrString
(
other
,
"keys"
))
{
/* never fails */
PyObject
*
keys
,
*
iterator
,
*
key
;
keys
=
PyObject_CallMethod
(
other
,
"keys"
,
NULL
);
if
(
keys
==
NULL
)
{
Py_DECREF
(
other
);
return
NULL
;
}
iterator
=
PyObject_GetIter
(
keys
);
Py_DECREF
(
keys
);
if
(
iterator
==
NULL
)
{
Py_INCREF
(
other
);
if
(
PyObject_HasAttrString
(
other
,
"items"
))
{
/* never fails */
PyObject
*
items
=
PyMapping_Items
(
other
);
Py_DECREF
(
other
);
return
NULL
;
if
(
items
==
NULL
)
return
NULL
;
res
=
mutablemapping_add_pairs
(
self
,
items
);
Py_DECREF
(
items
);
if
(
res
==
-
1
)
return
NULL
;
}
while
(
res
==
0
&&
(
key
=
PyIter_Next
(
iterator
)))
{
PyObject
*
value
=
PyObject_GetItem
(
other
,
key
);
if
(
value
!=
NULL
)
{
res
=
PyObject_SetItem
(
self
,
key
,
value
);
Py_DECREF
(
value
);
else
if
(
PyObject_HasAttrString
(
other
,
"keys"
))
{
/* never fails */
PyObject
*
keys
,
*
iterator
,
*
key
;
keys
=
PyObject_CallMethod
(
other
,
"keys"
,
NULL
);
if
(
keys
==
NULL
)
{
Py_DECREF
(
other
);
return
NULL
;
}
else
{
res
=
-
1
;
iterator
=
PyObject_GetIter
(
keys
);
Py_DECREF
(
keys
);
if
(
iterator
==
NULL
)
{
Py_DECREF
(
other
);
return
NULL
;
}
Py_DECREF
(
key
);
while
(
res
==
0
&&
(
key
=
PyIter_Next
(
iterator
)))
{
PyObject
*
value
=
PyObject_GetItem
(
other
,
key
);
if
(
value
!=
NULL
)
{
res
=
PyObject_SetItem
(
self
,
key
,
value
);
Py_DECREF
(
value
);
}
else
{
res
=
-
1
;
}
Py_DECREF
(
key
);
}
Py_DECREF
(
other
);
Py_DECREF
(
iterator
);
if
(
res
!=
0
||
PyErr_Occurred
())
return
NULL
;
}
else
{
res
=
mutablemapping_add_pairs
(
self
,
other
);
Py_DECREF
(
other
);
if
(
res
!=
0
)
return
NULL
;
}
Py_DECREF
(
other
);
Py_DECREF
(
iterator
);
if
(
res
!=
0
||
PyErr_Occurred
())
return
NULL
;
}
else
{
res
=
mutablemapping_add_pairs
(
self
,
other
);
Py_DECREF
(
other
);
if
(
res
!=
0
)
return
NULL
;
}
/* now handle kwargs */
len
=
(
kwargs
!=
NULL
)
?
PyObject_Size
(
kwargs
)
:
0
;
if
(
len
<
0
)
/* PyObject_Size raised an exception. */
return
NULL
;
PyObject
*
items
;
if
(
!
PyMapping_Check
(
kwargs
))
{
PyErr_SetString
(
PyExc_TypeError
,
"expected mapping for kwargs"
);
return
NULL
;
if
(
len
>
0
)
{
PyObject
*
items
;
if
(
!
PyMapping_Check
(
kwargs
))
{
PyErr_SetString
(
PyExc_TypeError
,
"expected mapping for kwargs"
);
return
NULL
;
}
items
=
PyMapping_Items
(
kwargs
);
if
(
items
==
NULL
)
return
NULL
;
res
=
mutablemapping_add_pairs
(
self
,
items
);
Py_DECREF
(
items
);
if
(
res
==
-
1
)
return
NULL
;
}
items
=
PyMapping_Items
(
kwargs
);
if
(
items
==
NULL
)
return
NULL
;
res
=
mutablemapping_add_pairs
(
self
,
items
);
Py_DECREF
(
items
);
if
(
res
==
-
1
)
return
NULL
;
Py_RETURN_NONE
;
}
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