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
bf88b68f
Kaydet (Commit)
bf88b68f
authored
Eki 05, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add documentation for the public API for weak reference objects.
üst
f7f8cad5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
1 deletion
+70
-1
api.tex
Doc/api/api.tex
+70
-1
No files found.
Doc/api/api.tex
Dosyayı görüntüle @
bf88b68f
...
...
@@ -1099,13 +1099,14 @@ completeness, here are all the variables:
\lineiii
{
PyExc
_
NotImplementedError
}{
\exception
{
NotImplementedError
}}{}
\lineiii
{
PyExc
_
OSError
}{
\exception
{
OSError
}}{}
\lineiii
{
PyExc
_
OverflowError
}{
\exception
{
OverflowError
}}{}
\lineiii
{
PyExc
_
ReferenceError
}{
\exception
{
ReferenceError
}}{
(2)
}
\lineiii
{
PyExc
_
RuntimeError
}{
\exception
{
RuntimeError
}}{}
\lineiii
{
PyExc
_
SyntaxError
}{
\exception
{
SyntaxError
}}{}
\lineiii
{
PyExc
_
SystemError
}{
\exception
{
SystemError
}}{}
\lineiii
{
PyExc
_
SystemExit
}{
\exception
{
SystemExit
}}{}
\lineiii
{
PyExc
_
TypeError
}{
\exception
{
TypeError
}}{}
\lineiii
{
PyExc
_
ValueError
}{
\exception
{
ValueError
}}{}
\lineiii
{
PyExc
_
WindowsError
}{
\exception
{
WindowsError
}}{
(
2
)
}
\lineiii
{
PyExc
_
WindowsError
}{
\exception
{
WindowsError
}}{
(
3
)
}
\lineiii
{
PyExc
_
ZeroDivisionError
}{
\exception
{
ZeroDivisionError
}}{}
\end{tableiii}
...
...
@@ -1116,6 +1117,9 @@ Notes:
This is a base class for other standard exceptions.
\item
[(2)]
This is the same as
\exception
{
weakref.ReferenceError
}
.
\item
[(3)]
Only defined on Windows; protect code that uses this by testing that
the preprocessor macro
\code
{
MS
_
WINDOWS
}
is defined.
\end{description}
...
...
@@ -4502,6 +4506,71 @@ returned.
\end{cfuncdesc}
\subsection
{
Weak Reference Objects
\label
{
weakref-objects
}}
Python supports
\emph
{
weak references
}
as first-class objects. There
are two specific object types which directly implement weak
references. The first is a simple reference object, and the second
acts as a proxy for the original object as much as it can.
\begin{cfuncdesc}
{
int
}{
PyWeakref
_
Check
}{
ob
}
Return true if
\var
{
ob
}
is either a reference or proxy object.
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyWeakref
_
CheckRef
}{
ob
}
Return true if
\var
{
ob
}
is a reference object.
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyWeakref
_
CheckProxy
}{
ob
}
Return true if
\var
{
ob
}
is a proxy object.
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyWeakref
_
NewRef
}{
PyObject *ob,
PyObject *callback
}
Return a weak reference object for the object
\var
{
ob
}
. This will
always return a new reference, but is not guaranteed to create a new
object; an existing reference object may be returned. The second
parameter,
\var
{
callback
}
, can be a callable object that receives
notification when
\var
{
ob
}
is garbage collected; it should accept a
single paramter, which will be the weak reference object itself.
\var
{
callback
}
may also be
\code
{
None
}
or
\NULL
. If
\var
{
ob
}
is not a weakly-referencable object, or if
\var
{
callback
}
is not
callable,
\code
{
None
}
, or
\NULL
, this will return
\NULL
{}
and
raise
\exception
{
TypeError
}
.
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyWeakref
_
NewProxy
}{
PyObject *ob,
PyObject *callback
}
Return a weak reference proxy object for the object
\var
{
ob
}
. This
will always return a new reference, but is not guaranteed to create
a new object; an existing proxy object may be returned. The second
parameter,
\var
{
callback
}
, can be a callable object that receives
notification when
\var
{
ob
}
is garbage collected; it should accept a
single paramter, which will be the weak reference object itself.
\var
{
callback
}
may also be
\code
{
None
}
or
\NULL
. If
\var
{
ob
}
is not
a weakly-referencable object, or if
\var
{
callback
}
is not callable,
\code
{
None
}
, or
\NULL
, this will return
\NULL
{}
and raise
\exception
{
TypeError
}
.
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyWeakref
_
GetObject
}{
PyObject *ref
}
Returns the referenced object from a weak reference,
\var
{
ref
}
. If
the referent is no longer live, returns
\NULL
.
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyWeakref
_
GET
_
OBJECT
}{
PyObject *ref
}
Similar to
\cfunction
{
PyWeakref
_
GetObject()
}
, but implemented as a
macro that does no error checking.
\versionadded
{
2.2
}
\end{cfuncdesc}
\subsection
{
CObjects
\label
{
cObjects
}}
\obindex
{
CObject
}
...
...
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