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
5ce2fecf
Kaydet (Commit)
5ce2fecf
authored
Kas 06, 2003
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #837322: Clarify owning, borrowing, stealing. Backported to 2.3.
üst
d2171d2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
intro.tex
Doc/api/intro.tex
+10
-6
No files found.
Doc/api/intro.tex
Dosyayı görüntüle @
5ce2fecf
...
@@ -169,12 +169,16 @@ becomes second nature.
...
@@ -169,12 +169,16 @@ becomes second nature.
\subsubsection
{
Reference Count Details
\label
{
refcountDetails
}}
\subsubsection
{
Reference Count Details
\label
{
refcountDetails
}}
The reference count behavior of functions in the Python/C API is best
The reference count behavior of functions in the Python/C API is best
explained in terms of
\emph
{
ownership of references
}
. Note that we
explained in terms of
\emph
{
ownership of references
}
. Ownership
talk of owning references, never of owning objects; objects are always
pertains to references, never to objects (objects are not owned: they
shared! When a function owns a reference, it has to dispose of it
are always shared). "Owning a reference" means being responsible for
properly --- either by passing ownership on (usually to its caller) or
calling Py
_
DECREF on it when the reference is no longer needed.
by calling
\cfunction
{
Py
_
DECREF()
}
or
\cfunction
{
Py
_
XDECREF()
}
. When
Ownership can also be transferred, meaning that the code that receives
a function passes ownership of a reference on to its caller, the
ownership of the reference then becomes responsible for eventually
decref'ing it by calling
\cfunction
{
Py
_
DECREF()
}
or
\cfunction
{
Py
_
XDECREF()
}
when it's no longer needed --or passing on
this responsibility (usually to its caller).
When a function passes ownership of a reference on to its caller, the
caller is said to receive a
\emph
{
new
}
reference. When no ownership
caller is said to receive a
\emph
{
new
}
reference. When no ownership
is transferred, the caller is said to
\emph
{
borrow
}
the reference.
is transferred, the caller is said to
\emph
{
borrow
}
the reference.
Nothing needs to be done for a borrowed reference.
Nothing needs to be done for a borrowed reference.
...
...
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