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
dee3f65d
Kaydet (Commit)
dee3f65d
authored
Ock 26, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert PySet_Add() changes.
üst
d3757233
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
16 deletions
+20
-16
set.rst
Doc/c-api/set.rst
+3
-8
setobject.c
Objects/setobject.c
+5
-0
marshal.c
Python/marshal.c
+12
-8
No files found.
Doc/c-api/set.rst
Dosyayı görüntüle @
dee3f65d
...
...
@@ -112,6 +112,9 @@ or :class:`frozenset` or instances of their subtypes.
the *key* is unhashable. Raise :exc:`PyExc_SystemError` if *anyset* is not a
:class:`set`, :class:`frozenset`, or an instance of a subtype.
The following functions are available for instances of :class:`set` or its
subtypes but not for instances of :class:`frozenset` or its subtypes.
.. cfunction:: int PySet_Add(PyObject *set, PyObject *key)
...
...
@@ -121,14 +124,6 @@ or :class:`frozenset` or instances of their subtypes.
Raise a :exc:`SystemError` if *set* is an not an instance of :class:`set` or its
subtype.
.. versionchanged:: 2.6
Now works with instances of :class:`frozenset` or its subtypes.
Like :cfunc:`PyTuple_SetItem` in that it can be used to fill-in the
values of brand new frozensets before they are exposed to other code.
The following functions are available for instances of :class:`set` or its
subtypes but not for instances of :class:`frozenset` or its subtypes.
.. cfunction:: int PySet_Discard(PyObject *set, PyObject *key)
...
...
Objects/setobject.c
Dosyayı görüntüle @
dee3f65d
...
...
@@ -2198,6 +2198,10 @@ PySet_Discard(PyObject *set, PyObject *key)
int
PySet_Add
(
PyObject
*
set
,
PyObject
*
key
)
{
if
(
!
PyType_IsSubtype
(
Py_TYPE
(
set
),
&
PySet_Type
))
{
PyErr_BadInternalCall
();
return
-
1
;
}
return
set_add_key
((
PySetObject
*
)
set
,
key
);
}
...
...
@@ -2341,6 +2345,7 @@ test_c_api(PySetObject *so)
f
=
PyFrozenSet_New
(
dup
);
assert
(
PySet_Size
(
f
)
==
3
);
assert
(
PyFrozenSet_CheckExact
(
f
));
assertRaises
(
PySet_Add
(
f
,
elem
)
==
-
1
,
PyExc_SystemError
);
assertRaises
(
PySet_Discard
(
f
,
elem
)
==
-
1
,
PyExc_SystemError
);
assertRaises
(
PySet_Pop
(
f
)
==
NULL
,
PyExc_SystemError
);
Py_DECREF
(
f
);
...
...
Python/marshal.c
Dosyayı görüntüle @
dee3f65d
...
...
@@ -860,7 +860,7 @@ r_object(RFILE *p)
retval
=
NULL
;
break
;
}
v
=
(
type
==
TYPE_SET
)
?
PySet_New
(
NULL
)
:
PyFrozenSet_New
(
NULL
);
v
=
PyTuple_New
((
int
)
n
);
if
(
v
==
NULL
)
{
retval
=
NULL
;
break
;
...
...
@@ -875,14 +875,18 @@ r_object(RFILE *p)
v
=
NULL
;
break
;
}
if
(
PySet_Add
(
v
,
v2
)
==
-
1
)
{
Py_DECREF
(
v
);
Py_DECREF
(
v2
);
v
=
NULL
;
break
;
}
PyTuple_SET_ITEM
(
v
,
(
int
)
i
,
v2
);
}
retval
=
(
v
==
NULL
)
?
NULL
:
v
;
if
(
v
==
NULL
)
{
retval
=
NULL
;
break
;
}
if
(
type
==
TYPE_SET
)
v3
=
PySet_New
(
v
);
else
v3
=
PyFrozenSet_New
(
v
);
Py_DECREF
(
v
);
retval
=
v3
;
break
;
case
TYPE_CODE
:
...
...
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