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
711e7d97
Kaydet (Commit)
711e7d97
authored
Tem 10, 2004
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add PyArg_VaParseTupleAndKeywords(). Document this function and
PyArg_VaParse(). Closes patch #550732. Thanks Greg Chapman.
üst
9a2a1cb0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
1 deletion
+55
-1
utilities.tex
Doc/api/utilities.tex
+14
-1
modsupport.h
Include/modsupport.h
+2
-0
NEWS
Misc/NEWS
+3
-0
getargs.c
Python/getargs.c
+36
-0
No files found.
Doc/api/utilities.tex
Dosyayı görüntüle @
711e7d97
...
...
@@ -145,7 +145,7 @@ values from C values.
\begin{cfuncdesc}
{
PyObject*
}{
PyImport
_
AddModule
}{
char *name
}
Return the module object corresponding to a module name. The
\var
{
name
}
argument may be of the form
\code
{
package.module
}
)
.
\var
{
name
}
argument may be of the form
\code
{
package.module
}
.
First check the modules dictionary if there's one there, and if not,
create a new one and insert it in the modules dictionary.
Return
\NULL
{}
with an exception set on failure.
...
...
@@ -675,6 +675,12 @@ return false and raise an appropriate exception.
failure, it returns false and raises the appropriate exception.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyArg
_
VaParse
}{
PyObject *args, char *format,
va
_
list vargs
}
Identical to
\cfunction
{
PyArg
_
ParseTuple()
}
, except that it accepts a
va
_
list rather than a variable number of arguments.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyArg
_
ParseTupleAndKeywords
}{
PyObject *args,
PyObject *kw, char *format, char *keywords[],
\moreargs
}
...
...
@@ -683,6 +689,13 @@ return false and raise an appropriate exception.
on failure, it returns false and raises the appropriate exception.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyArg
_
VaParseTupleAndKeywords
}{
PyObject *args,
PyObject *kw, char *format, char *keywords[],
va
_
list vargs
}
Identical to
\cfunction
{
PyArg
_
ParseTupleAndKeywords()
}
, except that it
accepts a va
_
list rather than a variable number of arguments.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyArg
_
Parse
}{
PyObject *args, char *format,
\moreargs
}
Function used to deconstruct the argument lists of ``old-style''
...
...
Include/modsupport.h
Dosyayı görüntüle @
711e7d97
...
...
@@ -17,6 +17,8 @@ PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...);
PyAPI_FUNC
(
PyObject
*
)
Py_BuildValue
(
char
*
,
...);
PyAPI_FUNC
(
int
)
PyArg_VaParse
(
PyObject
*
,
char
*
,
va_list
);
PyAPI_FUNC
(
int
)
PyArg_VaParseTupleAndKeywords
(
PyObject
*
,
PyObject
*
,
char
*
,
char
**
,
va_list
);
PyAPI_FUNC
(
PyObject
*
)
Py_VaBuildValue
(
char
*
,
va_list
);
PyAPI_FUNC
(
int
)
PyModule_AddObject
(
PyObject
*
,
char
*
,
PyObject
*
);
...
...
Misc/NEWS
Dosyayı görüntüle @
711e7d97
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.4 alpha 2?
Core and builtins
-----------------
- Patch #550732: Add PyArg_VaParseTupleAndKeywords(). Analogous to
PyArg_VaParse(). Both are now documented. Thanks Greg Chapman.
- Allow string and unicode return types from .encode()/.decode()
methods on string and unicode objects. Added unicode.decode()
which was missing for no apparent reason.
...
...
Python/getargs.c
Dosyayı görüntüle @
711e7d97
...
...
@@ -12,6 +12,9 @@ int PyArg_VaParse(PyObject *, char *, va_list);
int
PyArg_ParseTupleAndKeywords
(
PyObject
*
,
PyObject
*
,
char
*
,
char
**
,
...);
int
PyArg_VaParseTupleAndKeywords
(
PyObject
*
,
PyObject
*
,
char
*
,
char
**
,
va_list
);
/* Forward */
static
int
vgetargs1
(
PyObject
*
,
char
*
,
va_list
*
,
int
);
...
...
@@ -1153,6 +1156,39 @@ PyArg_ParseTupleAndKeywords(PyObject *args,
}
int
PyArg_VaParseTupleAndKeywords
(
PyObject
*
args
,
PyObject
*
keywords
,
char
*
format
,
char
**
kwlist
,
va_list
va
)
{
int
retval
;
va_list
lva
;
if
((
args
==
NULL
||
!
PyTuple_Check
(
args
))
||
(
keywords
!=
NULL
&&
!
PyDict_Check
(
keywords
))
||
format
==
NULL
||
kwlist
==
NULL
)
{
PyErr_BadInternalCall
();
return
0
;
}
#ifdef VA_LIST_IS_ARRAY
memcpy
(
lva
,
va
,
sizeof
(
va_list
));
#else
#ifdef __va_copy
__va_copy
(
lva
,
va
);
#else
lva
=
va
;
#endif
#endif
retval
=
vgetargskeywords
(
args
,
keywords
,
format
,
kwlist
,
&
lva
);
return
retval
;
}
static
int
vgetargskeywords
(
PyObject
*
args
,
PyObject
*
keywords
,
char
*
format
,
char
**
kwlist
,
va_list
*
p_va
)
...
...
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