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
f16c3dc8
Kaydet (Commit)
f16c3dc8
authored
Agu 09, 2002
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for the iterator protocol to weakref proxy objects.
Part of fixing SF bug #591704.
üst
ca3ac7f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
38 deletions
+64
-38
weakrefobject.c
Objects/weakrefobject.c
+64
-38
No files found.
Objects/weakrefobject.c
Dosyayı görüntüle @
f16c3dc8
...
...
@@ -383,6 +383,24 @@ proxy_setitem(PyWeakReference *proxy, PyObject *key, PyObject *value)
return
PyObject_SetItem
(
PyWeakref_GET_OBJECT
(
proxy
),
key
,
value
);
}
/* iterator slots */
static
PyObject
*
proxy_iter
(
PyWeakReference
*
proxy
)
{
if
(
!
proxy_checkref
(
proxy
))
return
NULL
;
return
PyObject_GetIter
(
PyWeakref_GET_OBJECT
(
proxy
));
}
static
PyObject
*
proxy_iternext
(
PyWeakReference
*
proxy
)
{
if
(
!
proxy_checkref
(
proxy
))
return
NULL
;
return
PyIter_Next
(
PyWeakref_GET_OBJECT
(
proxy
));
}
static
PyNumberMethods
proxy_as_number
=
{
(
binaryfunc
)
proxy_add
,
/*nb_add*/
...
...
@@ -447,26 +465,30 @@ _PyWeakref_ProxyType = {
sizeof
(
PyWeakReference
),
0
,
/* methods */
(
destructor
)
weakref_dealloc
,
/*tp_dealloc
*/
(
printfunc
)
proxy_print
,
/*tp_print
*/
0
,
/*tp_getattr
*/
0
,
/*tp_setattr
*/
proxy_compare
,
/*tp_compare
*/
(
unaryfunc
)
proxy_repr
,
/*tp_repr
*/
&
proxy_as_number
,
/*tp_as_number
*/
&
proxy_as_sequence
,
/*tp_as_sequence
*/
&
proxy_as_mapping
,
/*tp_as_mapping
*/
0
,
/*tp_hash
*/
(
ternaryfunc
)
0
,
/*tp_call
*/
(
unaryfunc
)
proxy_str
,
/*tp_str
*/
(
getattrofunc
)
proxy_getattr
,
/*tp_getattro
*/
(
setattrofunc
)
proxy_setattr
,
/*tp_setattro
*/
0
,
/*tp_as_buffer
*/
(
destructor
)
weakref_dealloc
,
/* tp_dealloc
*/
(
printfunc
)
proxy_print
,
/* tp_print
*/
0
,
/* tp_getattr
*/
0
,
/* tp_setattr
*/
proxy_compare
,
/* tp_compare
*/
(
unaryfunc
)
proxy_repr
,
/* tp_repr
*/
&
proxy_as_number
,
/* tp_as_number
*/
&
proxy_as_sequence
,
/* tp_as_sequence
*/
&
proxy_as_mapping
,
/* tp_as_mapping
*/
0
,
/* tp_hash
*/
(
ternaryfunc
)
0
,
/* tp_call
*/
(
unaryfunc
)
proxy_str
,
/* tp_str
*/
(
getattrofunc
)
proxy_getattr
,
/* tp_getattro
*/
(
setattrofunc
)
proxy_setattr
,
/* tp_setattro
*/
0
,
/* tp_as_buffer
*/
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_HAVE_GC
|
Py_TPFLAGS_CHECKTYPES
,
/*tp_flags*/
0
,
/*tp_doc*/
(
traverseproc
)
gc_traverse
,
/*tp_traverse*/
(
inquiry
)
gc_clear
,
/*tp_clear*/
|
Py_TPFLAGS_CHECKTYPES
,
/* tp_flags */
0
,
/* tp_doc */
(
traverseproc
)
gc_traverse
,
/* tp_traverse */
(
inquiry
)
gc_clear
,
/* tp_clear */
0
,
/* tp_richcompare */
0
,
/* tp_weaklistoffset */
(
getiterfunc
)
proxy_iter
,
/* tp_iter */
(
iternextfunc
)
proxy_iternext
,
/* tp_iternext */
};
...
...
@@ -478,26 +500,30 @@ _PyWeakref_CallableProxyType = {
sizeof
(
PyWeakReference
),
0
,
/* methods */
(
destructor
)
weakref_dealloc
,
/*tp_dealloc
*/
(
printfunc
)
proxy_print
,
/*tp_print
*/
0
,
/*tp_getattr
*/
0
,
/*tp_setattr
*/
proxy_compare
,
/*tp_compare
*/
(
unaryfunc
)
proxy_repr
,
/*tp_repr
*/
&
proxy_as_number
,
/*tp_as_number
*/
&
proxy_as_sequence
,
/*tp_as_sequence
*/
&
proxy_as_mapping
,
/*tp_as_mapping
*/
0
,
/*tp_hash
*/
(
ternaryfunc
)
proxy_call
,
/*tp_call
*/
(
unaryfunc
)
proxy_str
,
/*tp_str
*/
(
getattrofunc
)
proxy_getattr
,
/*tp_getattro
*/
(
setattrofunc
)
proxy_setattr
,
/*tp_setattro
*/
0
,
/*tp_as_buffer
*/
(
destructor
)
weakref_dealloc
,
/* tp_dealloc
*/
(
printfunc
)
proxy_print
,
/* tp_print
*/
0
,
/* tp_getattr
*/
0
,
/* tp_setattr
*/
proxy_compare
,
/* tp_compare
*/
(
unaryfunc
)
proxy_repr
,
/* tp_repr
*/
&
proxy_as_number
,
/* tp_as_number
*/
&
proxy_as_sequence
,
/* tp_as_sequence
*/
&
proxy_as_mapping
,
/* tp_as_mapping
*/
0
,
/* tp_hash
*/
(
ternaryfunc
)
proxy_call
,
/* tp_call
*/
(
unaryfunc
)
proxy_str
,
/* tp_str
*/
(
getattrofunc
)
proxy_getattr
,
/* tp_getattro
*/
(
setattrofunc
)
proxy_setattr
,
/* tp_setattro
*/
0
,
/* tp_as_buffer
*/
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_HAVE_GC
|
Py_TPFLAGS_CHECKTYPES
,
/*tp_flags*/
0
,
/*tp_doc*/
(
traverseproc
)
gc_traverse
,
/*tp_traverse*/
(
inquiry
)
gc_clear
,
/*tp_clear*/
|
Py_TPFLAGS_CHECKTYPES
,
/* tp_flags */
0
,
/* tp_doc */
(
traverseproc
)
gc_traverse
,
/* tp_traverse */
(
inquiry
)
gc_clear
,
/* tp_clear */
0
,
/* tp_richcompare */
0
,
/* tp_weaklistoffset */
(
getiterfunc
)
proxy_iter
,
/* tp_iter */
(
iternextfunc
)
proxy_iternext
,
/* tp_iternext */
};
...
...
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