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
aa6389e1
Kaydet (Commit)
aa6389e1
authored
Tem 14, 2004
tarafından
Jim Fulton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Documented the new Py_VISIT macro to simplify implementation of
tp_traverse handlers. (Tim made me do it. ;)
üst
8c5aeaa2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
newtypes.tex
Doc/api/newtypes.tex
+23
-0
objimpl.h
Include/objimpl.h
+10
-0
No files found.
Doc/api/newtypes.tex
Dosyayı görüntüle @
aa6389e1
...
@@ -1663,6 +1663,29 @@ The \member{tp_traverse} handler must have the following type:
...
@@ -1663,6 +1663,29 @@ The \member{tp_traverse} handler must have the following type:
that value should be returned immediately.
that value should be returned immediately.
\end{ctypedesc}
\end{ctypedesc}
To simplify writing
\member
{
tp
_
traverse
}
handlers, a
\cfunction
{
Py
_
VISIT()
}
is provided:
\begin{cfuncdesc}
{
void
}{
Py
_
VISIT
}{
PyObject *o
}
Call the
\var
{
visit
}
for
\var
{
o
}
with
\var
{
arg
}
. If
\var
{
visit
}
returns a non-zero value, then return it. Using this macro,
\member
{
tp
_
traverse
}
handlers look like:
\begin{verbatim}
static int
my
_
traverse(Noddy *self, visitproc visit, void *arg)
{
Py
_
VISIT(self->foo);
Py
_
VISIT(self->bar);
return 0;
}
\end{verbatim}
\versionadded
{
2.4
}
\end{cfuncdesc}
The
\member
{
tp
_
clear
}
handler must be of the
\ctype
{
inquiry
}
type, or
The
\member
{
tp
_
clear
}
handler must be of the
\ctype
{
inquiry
}
type, or
\NULL
{}
if the object is immutable.
\NULL
{}
if the object is immutable.
...
...
Include/objimpl.h
Dosyayı görüntüle @
aa6389e1
...
@@ -302,6 +302,16 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
...
@@ -302,6 +302,16 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
/* Utility macro to help write tp_traverse functions */
#define Py_VISIT(op) \
do { \
if (op) { \
int vret = visit((op), arg); \
if (vret) \
return vret; \
} \
} while (0)
/* This is here for the sake of backwards compatibility. Extensions that
/* This is here for the sake of backwards compatibility. Extensions that
* use the old GC API will still compile but the objects will not be
* use the old GC API will still compile but the objects will not be
* tracked by the GC. */
* tracked by the GC. */
...
...
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