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
7eac9b72
Kaydet (Commit)
7eac9b72
authored
Tem 12, 2001
tarafından
Neil Schemenauer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
GC for iterator objects.
üst
19cd292b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
iterobject.c
Objects/iterobject.c
+29
-6
No files found.
Objects/iterobject.c
Dosyayı görüntüle @
7eac9b72
...
...
@@ -18,15 +18,24 @@ PySeqIter_New(PyObject *seq)
it
->
it_index
=
0
;
Py_INCREF
(
seq
);
it
->
it_seq
=
seq
;
PyObject_GC_Init
(
it
);
return
(
PyObject
*
)
it
;
}
static
void
iter_dealloc
(
seqiterobject
*
it
)
{
PyObject_GC_Fini
(
it
);
Py_DECREF
(
it
->
it_seq
);
it
=
(
seqiterobject
*
)
PyObject_AS_GC
(
it
);
PyObject_DEL
(
it
);
}
static
int
iter_traverse
(
seqiterobject
*
it
,
visitproc
visit
,
void
*
arg
)
{
return
visit
(
it
->
it_seq
,
arg
);
}
static
PyObject
*
iter_next
(
seqiterobject
*
it
,
PyObject
*
args
)
{
...
...
@@ -97,7 +106,7 @@ PyTypeObject PySeqIter_Type = {
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
/* ob_size */
"iterator"
,
/* tp_name */
sizeof
(
seqiterobject
)
,
/* tp_basicsize */
sizeof
(
seqiterobject
)
+
PyGC_HEAD_SIZE
,
/* tp_basicsize */
0
,
/* tp_itemsize */
/* methods */
(
destructor
)
iter_dealloc
,
/* tp_dealloc */
...
...
@@ -115,9 +124,9 @@ PyTypeObject PySeqIter_Type = {
0
,
/* tp_getattro */
0
,
/* tp_setattro */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
,
/* tp_flags */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_GC
,
/* tp_flags */
0
,
/* tp_doc */
0
,
/* tp_traverse */
(
traverseproc
)
iter_traverse
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_richcompare */
0
,
/* tp_weaklistoffset */
...
...
@@ -144,16 +153,30 @@ PyCallIter_New(PyObject *callable, PyObject *sentinel)
it
->
it_callable
=
callable
;
Py_INCREF
(
sentinel
);
it
->
it_sentinel
=
sentinel
;
PyObject_GC_Init
(
it
);
return
(
PyObject
*
)
it
;
}
static
void
calliter_dealloc
(
calliterobject
*
it
)
{
PyObject_GC_Fini
(
it
);
Py_DECREF
(
it
->
it_callable
);
Py_DECREF
(
it
->
it_sentinel
);
it
=
(
calliterobject
*
)
PyObject_AS_GC
(
it
);
PyObject_DEL
(
it
);
}
static
int
calliter_traverse
(
calliterobject
*
it
,
visitproc
visit
,
void
*
arg
)
{
int
err
;
if
((
err
=
visit
(
it
->
it_callable
,
arg
)))
return
err
;
if
((
err
=
visit
(
it
->
it_sentinel
,
arg
)))
return
err
;
return
0
;
}
static
PyObject
*
calliter_next
(
calliterobject
*
it
,
PyObject
*
args
)
{
...
...
@@ -200,7 +223,7 @@ PyTypeObject PyCallIter_Type = {
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
/* ob_size */
"callable-iterator"
,
/* tp_name */
sizeof
(
calliterobject
)
,
/* tp_basicsize */
sizeof
(
calliterobject
)
+
PyGC_HEAD_SIZE
,
/* tp_basicsize */
0
,
/* tp_itemsize */
/* methods */
(
destructor
)
calliter_dealloc
,
/* tp_dealloc */
...
...
@@ -218,9 +241,9 @@ PyTypeObject PyCallIter_Type = {
0
,
/* tp_getattro */
0
,
/* tp_setattro */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
,
/* tp_flags */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_GC
,
/* tp_flags */
0
,
/* tp_doc */
0
,
/* tp_traverse */
(
traverseproc
)
calliter_traverse
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_richcompare */
0
,
/* tp_weaklistoffset */
...
...
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