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
0deab627
Kaydet (Commit)
0deab627
authored
Ara 13, 2003
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refactor set.discard() and set.remove().
üst
6a8bbdbe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
31 deletions
+22
-31
setobject.c
Objects/setobject.c
+22
-31
No files found.
Objects/setobject.c
Dosyayı görüntüle @
0deab627
...
...
@@ -777,21 +777,19 @@ This has no effect if the element is already present.");
static
PyObject
*
set_remove
(
PySetObject
*
so
,
PyObject
*
item
)
{
PyObject
*
tmp
;
PyObject
*
tmp
,
*
result
;
if
(
PyDict_DelItem
(
so
->
data
,
item
)
==
-
1
)
{
if
(
!
PyType_IsSubtype
(
item
->
ob_type
,
&
PySet_Type
))
return
NULL
;
PyErr_Clear
();
if
(
PyType_IsSubtype
(
item
->
ob_type
,
&
PySet_Type
))
{
tmp
=
frozenset_dict_wrapper
(((
PySetObject
*
)(
item
))
->
data
);
if
(
tmp
==
NULL
)
return
NULL
;
if
(
PyDict_DelItem
(
so
->
data
,
tmp
)
==
-
1
)
{
Py_DECREF
(
tmp
);
return
NULL
;
}
result
=
set_remove
(
so
,
tmp
);
Py_DECREF
(
tmp
);
return
result
;
}
if
(
PyDict_DelItem
(
so
->
data
,
item
)
==
-
1
)
return
NULL
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
...
...
@@ -804,28 +802,21 @@ If the element is not a member, raise a KeyError.");
static
PyObject
*
set_discard
(
PySetObject
*
so
,
PyObject
*
item
)
{
PyObject
*
tmp
;
PyObject
*
tmp
,
*
result
;
if
(
PyType_IsSubtype
(
item
->
ob_type
,
&
PySet_Type
))
{
tmp
=
frozenset_dict_wrapper
(((
PySetObject
*
)(
item
))
->
data
);
if
(
tmp
==
NULL
)
return
NULL
;
result
=
set_discard
(
so
,
tmp
);
Py_DECREF
(
tmp
);
return
result
;
}
if
(
PyDict_DelItem
(
so
->
data
,
item
)
==
-
1
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_KeyError
))
PyErr_Clear
();
else
{
if
(
!
PyType_IsSubtype
(
item
->
ob_type
,
&
PySet_Type
))
return
NULL
;
PyErr_Clear
();
tmp
=
frozenset_dict_wrapper
(((
PySetObject
*
)(
item
))
->
data
);
if
(
tmp
==
NULL
)
return
NULL
;
if
(
PyDict_DelItem
(
so
->
data
,
tmp
)
==
-
1
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_KeyError
))
PyErr_Clear
();
else
{
Py_DECREF
(
tmp
);
return
NULL
;
}
}
Py_DECREF
(
tmp
);
}
if
(
!
PyErr_ExceptionMatches
(
PyExc_KeyError
))
return
NULL
;
PyErr_Clear
();
}
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
@@ -916,7 +907,7 @@ static PyMethodDef set_methods[] = {
add_doc
},
{
"clear"
,
(
PyCFunction
)
set_clear
,
METH_NOARGS
,
clear_doc
},
{
"__contains__"
,
(
PyCFunction
)
set_direct_contains
,
METH_O
|
METH_COEXIST
,
{
"__contains__"
,(
PyCFunction
)
set_direct_contains
,
METH_O
|
METH_COEXIST
,
contains_doc
},
{
"copy"
,
(
PyCFunction
)
set_copy
,
METH_NOARGS
,
copy_doc
},
...
...
@@ -1044,7 +1035,7 @@ PyTypeObject PySet_Type = {
static
PyMethodDef
frozenset_methods
[]
=
{
{
"__contains__"
,
(
PyCFunction
)
set_direct_contains
,
METH_O
|
METH_COEXIST
,
{
"__contains__"
,(
PyCFunction
)
set_direct_contains
,
METH_O
|
METH_COEXIST
,
contains_doc
},
{
"copy"
,
(
PyCFunction
)
frozenset_copy
,
METH_NOARGS
,
copy_doc
},
...
...
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