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
c84f2c50
Kaydet (Commit)
c84f2c50
authored
Eki 23, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Documentation for the new PyArg_UnpackTuple() function.
üst
e4616e67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
utilities.tex
Doc/api/utilities.tex
+47
-0
No files found.
Doc/api/utilities.tex
Dosyayı görüntüle @
c84f2c50
...
@@ -388,6 +388,53 @@ Interpreter}.
...
@@ -388,6 +388,53 @@ Interpreter}.
purpose.
purpose.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyArg
_
UnpackTuple
}{
PyObject *args, char *name,
int min, int max,
\moreargs
}
A simpler form of parameter retrieval which does not use a format
string to specify the types of the arguments. Functions which use
this method to retrieve their parameters should be declared as
\constant
{
METH
_
VARARGS
}
in function or method tables. The tuple
containing the actual parameters should be passed as
\var
{
args
}
; it
must actually be a tuple. The length of the tuple must be at least
\var
{
min
}
and no more than
\var
{
max
}
;
\var
{
min
}
and
\var
{
max
}
may be
equal. Additional arguments must be passed to the function, each of
which should be a pointer to a
\ctype
{
PyObject*
}
variable; these
will be filled in with the values from
\var
{
args
}
; they will contain
borrowed references. The variables which correspond to optional
parameters not given by
\var
{
args
}
will not be filled in; these
should be initialized by the caller.
This function returns true on success and false if
\var
{
args
}
is not
a tuple or contains the wrong number of elements; an exception will
be set if there was a failure.
This is an example of the use of this function, taken from the
sources for the
\module
{_
weakref
}
helper module for weak references:
\begin{verbatim}
static PyObject *
weakref
_
ref(PyObject *self, PyObject *args)
{
PyObject *object;
PyObject *callback = NULL;
PyObject *result = NULL;
if (PyArg
_
UnpackTuple(args, "ref", 1, 2,
&
object,
&
callback))
{
result = PyWeakref
_
NewRef(object, callback);
}
return result;
}
\end{verbatim}
The call to
\cfunction
{
PyArg
_
UnpackTuple()
}
in this example is
entirely equivalent to this call to
\cfunction
{
PyArg
_
ParseTuple()
}
:
\begin{verbatim}
PyArg
_
ParseTuple(args, "O|O:ref",
&
object,
&
callback)
\end{verbatim}
\versionadded
{
2.2
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
Py
_
BuildValue
}{
char *format,
\begin{cfuncdesc}
{
PyObject*
}{
Py
_
BuildValue
}{
char *format,
\moreargs
}
\moreargs
}
Create a new value based on a format string similar to those
Create a new value based on a format string similar to those
...
...
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