Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
08e4a2be
Commit
08e4a2be
authored
Sep 03, 2005
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Correct PyBool_FromLong's return type and its description.
- Unify function description mode ("Return X" vs "Returns X")
parent
dd28ba99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
251 additions
and
251 deletions
+251
-251
Doc/api/concrete.tex
Doc/api/concrete.tex
+251
-251
No files found.
Doc/api/concrete.tex
View file @
08e4a2be
...
@@ -36,20 +36,20 @@ This section describes Python type objects and the singleton object
...
@@ -36,20 +36,20 @@ This section describes Python type objects and the singleton object
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyType
_
Check
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyType
_
Check
}{
PyObject *o
}
Return
s
true if the object
\var
{
o
}
is a type object, including
Return true if the object
\var
{
o
}
is a type object, including
instances of types derived from the standard type object. Return
s
instances of types derived from the standard type object. Return
false in all other cases.
false in all other cases.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyType
_
CheckExact
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyType
_
CheckExact
}{
PyObject *o
}
Return
s
true if the object
\var
{
o
}
is a type object, but not a
Return true if the object
\var
{
o
}
is a type object, but not a
subtype of the standard type object. Return
s
false in all other
subtype of the standard type object. Return false in all other
cases.
cases.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyType
_
HasFeature
}{
PyObject *o, int feature
}
\begin{cfuncdesc}
{
int
}{
PyType
_
HasFeature
}{
PyObject *o, int feature
}
Return
s
true if the type object
\var
{
o
}
sets the feature
Return true if the type object
\var
{
o
}
sets the feature
\var
{
feature
}
. Type features are denoted by single bit flags.
\var
{
feature
}
. Type features are denoted by single bit flags.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -60,7 +60,7 @@ This section describes Python type objects and the singleton object
...
@@ -60,7 +60,7 @@ This section describes Python type objects and the singleton object
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyType
_
IsSubtype
}{
PyTypeObject *a, PyTypeObject *b
}
\begin{cfuncdesc}
{
int
}{
PyType
_
IsSubtype
}{
PyTypeObject *a, PyTypeObject *b
}
Return
s
true if
\var
{
a
}
is a subtype of
\var
{
b
}
.
Return true if
\var
{
a
}
is a subtype of
\var
{
b
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -77,8 +77,8 @@ This section describes Python type objects and the singleton object
...
@@ -77,8 +77,8 @@ This section describes Python type objects and the singleton object
\begin{cfuncdesc}
{
int
}{
PyType
_
Ready
}{
PyTypeObject *type
}
\begin{cfuncdesc}
{
int
}{
PyType
_
Ready
}{
PyTypeObject *type
}
Finalize a type object. This should be called on all type objects
Finalize a type object. This should be called on all type objects
to finish their initialization. This function is responsible for
to finish their initialization. This function is responsible for
adding inherited slots from a type's base class. Return
s
\code
{
0
}
adding inherited slots from a type's base class. Return
\code
{
0
}
on success, or return
s
\code
{
-1
}
and sets an exception on error.
on success, or return
\code
{
-1
}
and sets an exception on error.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -98,7 +98,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
...
@@ -98,7 +98,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
\end{cvardesc}
\end{cvardesc}
\begin{csimplemacrodesc}
{
Py
_
RETURN
_
NONE
}
\begin{csimplemacrodesc}
{
Py
_
RETURN
_
NONE
}
Properly handle
s
returning
\cdata
{
Py
_
None
}
from within a C function.
Properly handle returning
\cdata
{
Py
_
None
}
from within a C function.
\end{csimplemacrodesc}
\end{csimplemacrodesc}
...
@@ -122,13 +122,13 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
...
@@ -122,13 +122,13 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyInt
_
Check
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyInt
_
Check
}{
PyObject *o
}
Return
s
true if
\var
{
o
}
is of type
\cdata
{
PyInt
_
Type
}
or a subtype
Return true if
\var
{
o
}
is of type
\cdata
{
PyInt
_
Type
}
or a subtype
of
\cdata
{
PyInt
_
Type
}
.
of
\cdata
{
PyInt
_
Type
}
.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyInt
_
CheckExact
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyInt
_
CheckExact
}{
PyObject *o
}
Return
s
true if
\var
{
o
}
is of type
\cdata
{
PyInt
_
Type
}
, but not a
Return true if
\var
{
o
}
is of type
\cdata
{
PyInt
_
Type
}
, but not a
subtype of
\cdata
{
PyInt
_
Type
}
.
subtype of
\cdata
{
PyInt
_
Type
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -153,7 +153,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
...
@@ -153,7 +153,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyInt
_
FromLong
}{
long ival
}
\begin{cfuncdesc}
{
PyObject*
}{
PyInt
_
FromLong
}{
long ival
}
Create
s
a new integer object with a value of
\var
{
ival
}
.
Create a new integer object with a value of
\var
{
ival
}
.
The current implementation keeps an array of integer objects for all
The current implementation keeps an array of integer objects for all
integers between
\code
{
-1
}
and
\code
{
100
}
, when you create an int in
integers between
\code
{
-1
}
and
\code
{
100
}
, when you create an int in
...
@@ -168,7 +168,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
...
@@ -168,7 +168,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
long
}{
PyInt
_
AS
_
LONG
}{
PyObject *io
}
\begin{cfuncdesc}
{
long
}{
PyInt
_
AS
_
LONG
}{
PyObject *io
}
Return
s
the value of the object
\var
{
io
}
. No error checking is
Return the value of the object
\var
{
io
}
. No error checking is
performed.
performed.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -187,7 +187,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
...
@@ -187,7 +187,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
long
}{
PyInt
_
GetMax
}{}
\begin{cfuncdesc}
{
long
}{
PyInt
_
GetMax
}{}
Return
s
the system's idea of the largest integer it can handle
Return the system's idea of the largest integer it can handle
(
\constant
{
LONG
_
MAX
}
\ttindex
{
LONG
_
MAX
}
, as defined in the system
(
\constant
{
LONG
_
MAX
}
\ttindex
{
LONG
_
MAX
}
, as defined in the system
header files).
header files).
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -200,7 +200,7 @@ such, the normal creation and deletion functions don't apply to
...
@@ -200,7 +200,7 @@ such, the normal creation and deletion functions don't apply to
booleans. The following macros are available, however.
booleans. The following macros are available, however.
\begin{cfuncdesc}
{
int
}{
PyBool
_
Check
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyBool
_
Check
}{
PyObject *o
}
Return
s
true if
\var
{
o
}
is of type
\cdata
{
PyBool
_
Type
}
.
Return true if
\var
{
o
}
is of type
\cdata
{
PyBool
_
Type
}
.
\versionadded
{
2.3
}
\versionadded
{
2.3
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -226,9 +226,9 @@ booleans. The following macros are available, however.
...
@@ -226,9 +226,9 @@ booleans. The following macros are available, however.
\versionadded
{
2.4
}
\versionadded
{
2.4
}
\end{csimplemacrodesc}
\end{csimplemacrodesc}
\begin{cfuncdesc}
{
int
}{
PyBool
_
FromLong
}{
long v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyBool
_
FromLong
}{
long v
}
Returns
\constant
{
Py
_
True
}
or
\constant
{
Py
_
False
}
depending on the
Return a new reference to
\constant
{
Py
_
True
}
or
\constant
{
Py
_
False
}
truth value of
\var
{
v
}
.
depending on the
truth value of
\var
{
v
}
.
\versionadded
{
2.3
}
\versionadded
{
2.3
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -247,39 +247,39 @@ truth value of \var{v}.
...
@@ -247,39 +247,39 @@ truth value of \var{v}.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyLong
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyLong
_
Check
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyLongObject
}
or a subtype
Return true if its argument is a
\ctype
{
PyLongObject
}
or a subtype
of
\ctype
{
PyLongObject
}
.
of
\ctype
{
PyLongObject
}
.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyLong
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyLong
_
CheckExact
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyLongObject
}
, but not a
Return true if its argument is a
\ctype
{
PyLongObject
}
, but not a
subtype of
\ctype
{
PyLongObject
}
.
subtype of
\ctype
{
PyLongObject
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromLong
}{
long v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromLong
}{
long v
}
Return
s
a new
\ctype
{
PyLongObject
}
object from
\var
{
v
}
, or
\NULL
{}
Return a new
\ctype
{
PyLongObject
}
object from
\var
{
v
}
, or
\NULL
{}
on failure.
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromUnsignedLong
}{
unsigned long v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromUnsignedLong
}{
unsigned long v
}
Return
s
a new
\ctype
{
PyLongObject
}
object from a C
\ctype
{
unsigned
Return a new
\ctype
{
PyLongObject
}
object from a C
\ctype
{
unsigned
long
}
, or
\NULL
{}
on failure.
long
}
, or
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromLongLong
}{
long long v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromLongLong
}{
long long v
}
Return
s
a new
\ctype
{
PyLongObject
}
object from a C
\ctype
{
long long
}
,
Return a new
\ctype
{
PyLongObject
}
object from a C
\ctype
{
long long
}
,
or
\NULL
{}
on failure.
or
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromUnsignedLongLong
}{
unsigned long long v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromUnsignedLongLong
}{
unsigned long long v
}
Return
s
a new
\ctype
{
PyLongObject
}
object from a C
\ctype
{
unsigned
Return a new
\ctype
{
PyLongObject
}
object from a C
\ctype
{
unsigned
long long
}
, or
\NULL
{}
on failure.
long long
}
, or
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromDouble
}{
double v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyLong
_
FromDouble
}{
double v
}
Return
s
a new
\ctype
{
PyLongObject
}
object from the integer part of
Return a new
\ctype
{
PyLongObject
}
object from the integer part of
\var
{
v
}
, or
\NULL
{}
on failure.
\var
{
v
}
, or
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -318,7 +318,7 @@ truth value of \var{v}.
...
@@ -318,7 +318,7 @@ truth value of \var{v}.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
long
}{
PyLong
_
AsLong
}{
PyObject *pylong
}
\begin{cfuncdesc}
{
long
}{
PyLong
_
AsLong
}{
PyObject *pylong
}
Return
s
a C
\ctype
{
long
}
representation of the contents of
Return a C
\ctype
{
long
}
representation of the contents of
\var
{
pylong
}
. If
\var
{
pylong
}
is greater than
\var
{
pylong
}
. If
\var
{
pylong
}
is greater than
\constant
{
LONG
_
MAX
}
\ttindex
{
LONG
_
MAX
}
, an
\exception
{
OverflowError
}
\constant
{
LONG
_
MAX
}
\ttindex
{
LONG
_
MAX
}
, an
\exception
{
OverflowError
}
is raised.
is raised.
...
@@ -326,7 +326,7 @@ truth value of \var{v}.
...
@@ -326,7 +326,7 @@ truth value of \var{v}.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
unsigned long
}{
PyLong
_
AsUnsignedLong
}{
PyObject *pylong
}
\begin{cfuncdesc}
{
unsigned long
}{
PyLong
_
AsUnsignedLong
}{
PyObject *pylong
}
Return
s
a C
\ctype
{
unsigned long
}
representation of the contents of
Return a C
\ctype
{
unsigned long
}
representation of the contents of
\var
{
pylong
}
. If
\var
{
pylong
}
is greater than
\var
{
pylong
}
. If
\var
{
pylong
}
is greater than
\constant
{
ULONG
_
MAX
}
\ttindex
{
ULONG
_
MAX
}
, an
\constant
{
ULONG
_
MAX
}
\ttindex
{
ULONG
_
MAX
}
, an
\exception
{
OverflowError
}
is raised.
\exception
{
OverflowError
}
is raised.
...
@@ -363,7 +363,7 @@ truth value of \var{v}.
...
@@ -363,7 +363,7 @@ truth value of \var{v}.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyLong
_
AsDouble
}{
PyObject *pylong
}
\begin{cfuncdesc}
{
double
}{
PyLong
_
AsDouble
}{
PyObject *pylong
}
Return
s
a C
\ctype
{
double
}
representation of the contents of
Return a C
\ctype
{
double
}
representation of the contents of
\var
{
pylong
}
. If
\var
{
pylong
}
cannot be approximately represented
\var
{
pylong
}
. If
\var
{
pylong
}
cannot be approximately represented
as a
\ctype
{
double
}
, an
\exception
{
OverflowError
}
exception is
as a
\ctype
{
double
}
, an
\exception
{
OverflowError
}
exception is
raised and
\code
{
-1.0
}
will be returned.
raised and
\code
{
-1.0
}
will be returned.
...
@@ -394,35 +394,35 @@ truth value of \var{v}.
...
@@ -394,35 +394,35 @@ truth value of \var{v}.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyFloat
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyFloat
_
Check
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyFloatObject
}
or a subtype
Return true if its argument is a
\ctype
{
PyFloatObject
}
or a subtype
of
\ctype
{
PyFloatObject
}
.
of
\ctype
{
PyFloatObject
}
.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyFloat
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyFloat
_
CheckExact
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyFloatObject
}
, but not a
Return true if its argument is a
\ctype
{
PyFloatObject
}
, but not a
subtype of
\ctype
{
PyFloatObject
}
.
subtype of
\ctype
{
PyFloatObject
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFloat
_
FromString
}{
PyObject *str, char **pend
}
\begin{cfuncdesc}
{
PyObject*
}{
PyFloat
_
FromString
}{
PyObject *str, char **pend
}
Create
s
a
\ctype
{
PyFloatObject
}
object based on the string value in
Create a
\ctype
{
PyFloatObject
}
object based on the string value in
\var
{
str
}
, or
\NULL
{}
on failure. The
\var
{
pend
}
argument is ignored. It
\var
{
str
}
, or
\NULL
{}
on failure. The
\var
{
pend
}
argument is ignored. It
remains only for backward compatibility.
remains only for backward compatibility.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFloat
_
FromDouble
}{
double v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyFloat
_
FromDouble
}{
double v
}
Create
s
a
\ctype
{
PyFloatObject
}
object from
\var
{
v
}
, or
\NULL
{}
on
Create a
\ctype
{
PyFloatObject
}
object from
\var
{
v
}
, or
\NULL
{}
on
failure.
failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AsDouble
}{
PyObject *pyfloat
}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AsDouble
}{
PyObject *pyfloat
}
Return
s
a C
\ctype
{
double
}
representation of the contents of
Return a C
\ctype
{
double
}
representation of the contents of
\var
{
pyfloat
}
.
\var
{
pyfloat
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AS
_
DOUBLE
}{
PyObject *pyfloat
}
\begin{cfuncdesc}
{
double
}{
PyFloat
_
AS
_
DOUBLE
}{
PyObject *pyfloat
}
Return
s
a C
\ctype
{
double
}
representation of the contents of
Return a C
\ctype
{
double
}
representation of the contents of
\var
{
pyfloat
}
, but without error checking.
\var
{
pyfloat
}
, but without error checking.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -502,13 +502,13 @@ typedef struct {
...
@@ -502,13 +502,13 @@ typedef struct {
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyComplex
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyComplex
_
Check
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyComplexObject
}
or a
Return true if its argument is a
\ctype
{
PyComplexObject
}
or a
subtype of
\ctype
{
PyComplexObject
}
.
subtype of
\ctype
{
PyComplexObject
}
.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyComplex
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyComplex
_
CheckExact
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyComplexObject
}
, but not a
Return true if its argument is a
\ctype
{
PyComplexObject
}
, but not a
subtype of
\ctype
{
PyComplexObject
}
.
subtype of
\ctype
{
PyComplexObject
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -519,20 +519,20 @@ typedef struct {
...
@@ -519,20 +519,20 @@ typedef struct {
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyComplex
_
FromDoubles
}{
double real, double imag
}
\begin{cfuncdesc}
{
PyObject*
}{
PyComplex
_
FromDoubles
}{
double real, double imag
}
Return
s
a new
\ctype
{
PyComplexObject
}
object from
\var
{
real
}
and
Return a new
\ctype
{
PyComplexObject
}
object from
\var
{
real
}
and
\var
{
imag
}
.
\var
{
imag
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
RealAsDouble
}{
PyObject *op
}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
RealAsDouble
}{
PyObject *op
}
Return
s
the real part of
\var
{
op
}
as a C
\ctype
{
double
}
.
Return the real part of
\var
{
op
}
as a C
\ctype
{
double
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
ImagAsDouble
}{
PyObject *op
}
\begin{cfuncdesc}
{
double
}{
PyComplex
_
ImagAsDouble
}{
PyObject *op
}
Return
s
the imaginary part of
\var
{
op
}
as a C
\ctype
{
double
}
.
Return the imaginary part of
\var
{
op
}
as a C
\ctype
{
double
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
complex
}{
PyComplex
_
AsCComplex
}{
PyObject *op
}
\begin{cfuncdesc}
{
Py
_
complex
}{
PyComplex
_
AsCComplex
}{
PyObject *op
}
Return
s
the
\ctype
{
Py
_
complex
}
value of the complex number
Return the
\ctype
{
Py
_
complex
}
value of the complex number
\var
{
op
}
.
\var
{
op
}
.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -564,34 +564,34 @@ parameter and are called with a non-string parameter.
...
@@ -564,34 +564,34 @@ parameter and are called with a non-string parameter.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
Check
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyString
_
Check
}{
PyObject *o
}
Return
s
true if the object
\var
{
o
}
is a string object or an instance
Return true if the object
\var
{
o
}
is a string object or an instance
of a subtype of the string type.
of a subtype of the string type.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
CheckExact
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyString
_
CheckExact
}{
PyObject *o
}
Return
s
true if the object
\var
{
o
}
is a string object, but not an
Return true if the object
\var
{
o
}
is a string object, but not an
instance of a subtype of the string type.
instance of a subtype of the string type.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromString
}{
const char *v
}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromString
}{
const char *v
}
Return
s
a new string object with the value
\var
{
v
}
on success, and
Return a new string object with the value
\var
{
v
}
on success, and
\NULL
{}
on failure. The parameter
\var
{
v
}
must not be
\NULL
{}
; it
\NULL
{}
on failure. The parameter
\var
{
v
}
must not be
\NULL
{}
; it
will not be checked.
will not be checked.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromStringAndSize
}{
const char *v,
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromStringAndSize
}{
const char *v,
int len
}
int len
}
Return
s
a new string object with the value
\var
{
v
}
and length
Return a new string object with the value
\var
{
v
}
and length
\var
{
len
}
on success, and
\NULL
{}
on failure. If
\var
{
v
}
is
\var
{
len
}
on success, and
\NULL
{}
on failure. If
\var
{
v
}
is
\NULL
{}
, the contents of the string are uninitialized.
\NULL
{}
, the contents of the string are uninitialized.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromFormat
}{
const char *format, ...
}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
FromFormat
}{
const char *format, ...
}
Take
s
a C
\cfunction
{
printf()
}
-style
\var
{
format
}
string and a
Take a C
\cfunction
{
printf()
}
-style
\var
{
format
}
string and a
variable number of arguments, calculate
s
the size of the resulting
variable number of arguments, calculate the size of the resulting
Python string and return
s
a string with the values formatted into
Python string and return a string with the values formatted into
it. The variable arguments must be C types and must correspond
it. The variable arguments must be C types and must correspond
exactly to the format characters in the
\var
{
format
}
string. The
exactly to the format characters in the
\var
{
format
}
string. The
following format characters are allowed:
following format characters are allowed:
...
@@ -618,7 +618,7 @@ parameter and are called with a non-string parameter.
...
@@ -618,7 +618,7 @@ parameter and are called with a non-string parameter.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
Size
}{
PyObject *string
}
\begin{cfuncdesc}
{
int
}{
PyString
_
Size
}{
PyObject *string
}
Return
s
the length of the string in string object
\var
{
string
}
.
Return the length of the string in string object
\var
{
string
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyString
_
GET
_
SIZE
}{
PyObject *string
}
\begin{cfuncdesc}
{
int
}{
PyString
_
GET
_
SIZE
}{
PyObject *string
}
...
@@ -627,7 +627,7 @@ parameter and are called with a non-string parameter.
...
@@ -627,7 +627,7 @@ parameter and are called with a non-string parameter.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
char*
}{
PyString
_
AsString
}{
PyObject *string
}
\begin{cfuncdesc}
{
char*
}{
PyString
_
AsString
}{
PyObject *string
}
Return
s
a NUL-terminated representation of the contents of
Return a NUL-terminated representation of the contents of
\var
{
string
}
. The pointer refers to the internal buffer of
\var
{
string
}
. The pointer refers to the internal buffer of
\var
{
string
}
, not a copy. The data must not be modified in any way,
\var
{
string
}
, not a copy. The data must not be modified in any way,
unless the string was just created using
unless the string was just created using
...
@@ -648,7 +648,7 @@ parameter and are called with a non-string parameter.
...
@@ -648,7 +648,7 @@ parameter and are called with a non-string parameter.
\begin{cfuncdesc}
{
int
}{
PyString
_
AsStringAndSize
}{
PyObject *obj,
\begin{cfuncdesc}
{
int
}{
PyString
_
AsStringAndSize
}{
PyObject *obj,
char **buffer,
char **buffer,
int *length
}
int *length
}
Return
s
a NUL-terminated representation of the contents of the
Return a NUL-terminated representation of the contents of the
object
\var
{
obj
}
through the output variables
\var
{
buffer
}
and
object
\var
{
obj
}
through the output variables
\var
{
buffer
}
and
\var
{
length
}
.
\var
{
length
}
.
...
@@ -670,7 +670,7 @@ parameter and are called with a non-string parameter.
...
@@ -670,7 +670,7 @@ parameter and are called with a non-string parameter.
\begin{cfuncdesc}
{
void
}{
PyString
_
Concat
}{
PyObject **string,
\begin{cfuncdesc}
{
void
}{
PyString
_
Concat
}{
PyObject **string,
PyObject *newpart
}
PyObject *newpart
}
Create
s
a new string object in
\var
{
*string
}
containing the contents
Create a new string object in
\var
{
*string
}
containing the contents
of
\var
{
newpart
}
appended to
\var
{
string
}
; the caller will own the
of
\var
{
newpart
}
appended to
\var
{
string
}
; the caller will own the
new reference. The reference to the old value of
\var
{
string
}
will
new reference. The reference to the old value of
\var
{
string
}
will
be stolen. If the new string cannot be created, the old reference
be stolen. If the new string cannot be created, the old reference
...
@@ -681,7 +681,7 @@ parameter and are called with a non-string parameter.
...
@@ -681,7 +681,7 @@ parameter and are called with a non-string parameter.
\begin{cfuncdesc}
{
void
}{
PyString
_
ConcatAndDel
}{
PyObject **string,
\begin{cfuncdesc}
{
void
}{
PyString
_
ConcatAndDel
}{
PyObject **string,
PyObject *newpart
}
PyObject *newpart
}
Create
s
a new string object in
\var
{
*string
}
containing the contents
Create a new string object in
\var
{
*string
}
containing the contents
of
\var
{
newpart
}
appended to
\var
{
string
}
. This version decrements
of
\var
{
newpart
}
appended to
\var
{
string
}
. This version decrements
the reference count of
\var
{
newpart
}
.
the reference count of
\var
{
newpart
}
.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -703,7 +703,7 @@ parameter and are called with a non-string parameter.
...
@@ -703,7 +703,7 @@ parameter and are called with a non-string parameter.
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
Format
}{
PyObject *format,
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
Format
}{
PyObject *format,
PyObject *args
}
PyObject *args
}
Return
s
a new string object from
\var
{
format
}
and
\var
{
args
}
.
Return a new string object from
\var
{
format
}
and
\var
{
args
}
.
Analogous to
\code
{
\var
{
format
}
\%\ \var
{
args
}}
. The
\var
{
args
}
Analogous to
\code
{
\var
{
format
}
\%\ \var
{
args
}}
. The
\var
{
args
}
argument must be a tuple.
argument must be a tuple.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -733,48 +733,48 @@ parameter and are called with a non-string parameter.
...
@@ -733,48 +733,48 @@ parameter and are called with a non-string parameter.
int size,
int size,
const char *encoding,
const char *encoding,
const char *errors
}
const char *errors
}
Create
s
an object by decoding
\var
{
size
}
bytes of the encoded
Create an object by decoding
\var
{
size
}
bytes of the encoded
buffer
\var
{
s
}
using the codec registered for
buffer
\var
{
s
}
using the codec registered for
\var
{
encoding
}
.
\var
{
encoding
}
and
\var
{
errors
}
have the same
\var
{
encoding
}
.
\var
{
encoding
}
and
\var
{
errors
}
have the same
meaning as the parameters of the same name in the
meaning as the parameters of the same name in the
\function
{
unicode()
}
built-in function. The codec to be used is
\function
{
unicode()
}
built-in function. The codec to be used is
looked up using the Python codec registry. Return
s
\NULL
{}
if
looked up using the Python codec registry. Return
\NULL
{}
if
an exception was raised by the codec.
an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
AsDecodedObject
}{
PyObject *str,
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
AsDecodedObject
}{
PyObject *str,
const char *encoding,
const char *encoding,
const char *errors
}
const char *errors
}
Decode
s
a string object by passing it to the codec registered for
Decode a string object by passing it to the codec registered for
\var
{
encoding
}
and return
s
the result as Python
\var
{
encoding
}
and return the result as Python
object.
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
object.
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
parameters of the same name in the string
\method
{
encode()
}
method.
parameters of the same name in the string
\method
{
encode()
}
method.
The codec to be used is looked up using the Python codec registry.
The codec to be used is looked up using the Python codec registry.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
Encode
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
Encode
}{
const char *s,
int size,
int size,
const char *encoding,
const char *encoding,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
char
}
buffer of the given size by passing it to
Encode the
\ctype
{
char
}
buffer of the given size by passing it to
the codec registered for
\var
{
encoding
}
and return
s
a Python object.
the codec registered for
\var
{
encoding
}
and return a Python object.
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
parameters of the same name in the string
\method
{
encode()
}
method.
parameters of the same name in the string
\method
{
encode()
}
method.
The codec to be used is looked up using the Python codec
The codec to be used is looked up using the Python codec
registry. Return
s
\NULL
{}
if an exception was raised by the
registry. Return
\NULL
{}
if an exception was raised by the
codec.
codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
AsEncodedObject
}{
PyObject *str,
\begin{cfuncdesc}
{
PyObject*
}{
PyString
_
AsEncodedObject
}{
PyObject *str,
const char *encoding,
const char *encoding,
const char *errors
}
const char *errors
}
Encode
s
a string object using the codec registered for
Encode a string object using the codec registered for
\var
{
encoding
}
and return
s
the result as Python object.
\var
{
encoding
}
and return the result as Python object.
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
parameters of the same name in the string
\method
{
encode()
}
method.
parameters of the same name in the string
\method
{
encode()
}
method.
The codec to be used is looked up using the Python codec registry.
The codec to be used is looked up using the Python codec registry.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -808,34 +808,34 @@ The following APIs are really C macros and can be used to do fast
...
@@ -808,34 +808,34 @@ The following APIs are really C macros and can be used to do fast
checks and to access internal read-only data of Unicode objects:
checks and to access internal read-only data of Unicode objects:
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
Check
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
Check
}{
PyObject *o
}
Return
s
true if the object
\var
{
o
}
is a Unicode object or an
Return true if the object
\var
{
o
}
is a Unicode object or an
instance of a Unicode subtype.
instance of a Unicode subtype.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
CheckExact
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
CheckExact
}{
PyObject *o
}
Return
s
true if the object
\var
{
o
}
is a Unicode object, but not an
Return true if the object
\var
{
o
}
is a Unicode object, but not an
instance of a subtype.
instance of a subtype.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
GET
_
SIZE
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
GET
_
SIZE
}{
PyObject *o
}
Return
s
the size of the object.
\var
{
o
}
has to be a
Return the size of the object.
\var
{
o
}
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
\ctype
{
PyUnicodeObject
}
(not checked).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
GET
_
DATA
_
SIZE
}{
PyObject *o
}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
GET
_
DATA
_
SIZE
}{
PyObject *o
}
Return
s
the size of the object's internal buffer in bytes.
\var
{
o
}
Return the size of the object's internal buffer in bytes.
\var
{
o
}
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
UNICODE*
}{
PyUnicode
_
AS
_
UNICODE
}{
PyObject *o
}
\begin{cfuncdesc}
{
Py
_
UNICODE*
}{
PyUnicode
_
AS
_
UNICODE
}{
PyObject *o
}
Return
s
a pointer to the internal
\ctype
{
Py
_
UNICODE
}
buffer of the
Return a pointer to the internal
\ctype
{
Py
_
UNICODE
}
buffer of the
object.
\var
{
o
}
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
object.
\var
{
o
}
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
const char*
}{
PyUnicode
_
AS
_
DATA
}{
PyObject *o
}
\begin{cfuncdesc}
{
const char*
}{
PyUnicode
_
AS
_
DATA
}{
PyObject *o
}
Return
s
a pointer to the internal buffer of the object.
Return a pointer to the internal buffer of the object.
\var
{
o
}
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
\var
{
o
}
has to be a
\ctype
{
PyUnicodeObject
}
(not checked).
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -846,78 +846,78 @@ needed ones are available through these macros which are mapped to C
...
@@ -846,78 +846,78 @@ needed ones are available through these macros which are mapped to C
functions depending on the Python configuration.
functions depending on the Python configuration.
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISSPACE
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISSPACE
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a whitespace
Return
1 or
0 depending on whether
\var
{
ch
}
is a whitespace
character.
character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISLOWER
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISLOWER
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a lowercase character.
Return
1 or
0 depending on whether
\var
{
ch
}
is a lowercase character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISUPPER
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISUPPER
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is an uppercase
Return
1 or
0 depending on whether
\var
{
ch
}
is an uppercase
character.
character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISTITLE
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISTITLE
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a titlecase character.
Return
1 or
0 depending on whether
\var
{
ch
}
is a titlecase character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISLINEBREAK
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISLINEBREAK
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a linebreak character.
Return
1 or
0 depending on whether
\var
{
ch
}
is a linebreak character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISDECIMAL
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISDECIMAL
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a decimal character.
Return
1 or
0 depending on whether
\var
{
ch
}
is a decimal character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISDIGIT
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISDIGIT
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a digit character.
Return
1 or
0 depending on whether
\var
{
ch
}
is a digit character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISNUMERIC
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISNUMERIC
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is a numeric character.
Return
1 or
0 depending on whether
\var
{
ch
}
is a numeric character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISALPHA
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISALPHA
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is an alphabetic
Return
1 or
0 depending on whether
\var
{
ch
}
is an alphabetic
character.
character.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISALNUM
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
ISALNUM
}{
Py
_
UNICODE ch
}
Return
s 1/
0 depending on whether
\var
{
ch
}
is an alphanumeric
Return
1 or
0 depending on whether
\var
{
ch
}
is an alphanumeric
character.
character.
\end{cfuncdesc}
\end{cfuncdesc}
These APIs can be used for fast direct character conversions:
These APIs can be used for fast direct character conversions:
\begin{cfuncdesc}
{
Py
_
UNICODE
}{
Py
_
UNICODE
_
TOLOWER
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
Py
_
UNICODE
}{
Py
_
UNICODE
_
TOLOWER
}{
Py
_
UNICODE ch
}
Return
s
the character
\var
{
ch
}
converted to lower case.
Return the character
\var
{
ch
}
converted to lower case.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
UNICODE
}{
Py
_
UNICODE
_
TOUPPER
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
Py
_
UNICODE
}{
Py
_
UNICODE
_
TOUPPER
}{
Py
_
UNICODE ch
}
Return
s
the character
\var
{
ch
}
converted to upper case.
Return the character
\var
{
ch
}
converted to upper case.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
UNICODE
}{
Py
_
UNICODE
_
TOTITLE
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
Py
_
UNICODE
}{
Py
_
UNICODE
_
TOTITLE
}{
Py
_
UNICODE ch
}
Return
s
the character
\var
{
ch
}
converted to title case.
Return the character
\var
{
ch
}
converted to title case.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
TODECIMAL
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
TODECIMAL
}{
Py
_
UNICODE ch
}
Return
s
the character
\var
{
ch
}
converted to a decimal positive
Return the character
\var
{
ch
}
converted to a decimal positive
integer. Return
s
\code
{
-1
}
if this is not possible. Does not raise
integer. Return
\code
{
-1
}
if this is not possible. This macro
exceptions.
does not raise
exceptions.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
TODIGIT
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
int
}{
Py
_
UNICODE
_
TODIGIT
}{
Py
_
UNICODE ch
}
Return
s
the character
\var
{
ch
}
converted to a single digit integer.
Return the character
\var
{
ch
}
converted to a single digit integer.
Return
s
\code
{
-1
}
if this is not possible. D
oes not raise
Return
\code
{
-1
}
if this is not possible. This macro d
oes not raise
exceptions.
exceptions.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
double
}{
Py
_
UNICODE
_
TONUMERIC
}{
Py
_
UNICODE ch
}
\begin{cfuncdesc}
{
double
}{
Py
_
UNICODE
_
TONUMERIC
}{
Py
_
UNICODE ch
}
Return
s
the character
\var
{
ch
}
converted to a (positive) double.
Return the character
\var
{
ch
}
converted to a (positive) double.
Return
s
\code
{
-1.0
}
if this is not possible. D
oes not raise
Return
\code
{
-1.0
}
if this is not possible. This macro d
oes not raise
exceptions.
exceptions.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -988,15 +988,15 @@ following functions. Support is optimized if Python's own
...
@@ -988,15 +988,15 @@ following functions. Support is optimized if Python's own
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
FromWideChar
}{
const wchar
_
t *w,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
FromWideChar
}{
const wchar
_
t *w,
int size
}
int size
}
Create a Unicode object from the
\ctype
{
wchar
_
t
}
buffer
\var
{
w
}
of
Create a Unicode object from the
\ctype
{
wchar
_
t
}
buffer
\var
{
w
}
of
the given size. Return
s
\NULL
{}
on failure.
the given size. Return
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
AsWideChar
}{
PyUnicodeObject *unicode,
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
AsWideChar
}{
PyUnicodeObject *unicode,
wchar
_
t *w,
wchar
_
t *w,
int size
}
int size
}
Cop
ies
the Unicode object contents into the
\ctype
{
wchar
_
t
}
buffer
Cop
y
the Unicode object contents into the
\ctype
{
wchar
_
t
}
buffer
\var
{
w
}
. At most
\var
{
size
}
\ctype
{
wchar
_
t
}
characters are copied
\var
{
w
}
. At most
\var
{
size
}
\ctype
{
wchar
_
t
}
characters are copied
(excluding a possibly trailing 0-termination character). Return
s
(excluding a possibly trailing 0-termination character). Return
the number of
\ctype
{
wchar
_
t
}
characters copied or -1 in case of an
the number of
\ctype
{
wchar
_
t
}
characters copied or -1 in case of an
error. Note that the resulting
\ctype
{
wchar
_
t
}
string may or may
error. Note that the resulting
\ctype
{
wchar
_
t
}
string may or may
not be 0-terminated. It is the responsibility of the caller to make
not be 0-terminated. It is the responsibility of the caller to make
...
@@ -1042,7 +1042,7 @@ These are the generic codec APIs:
...
@@ -1042,7 +1042,7 @@ These are the generic codec APIs:
string
\var
{
s
}
.
\var
{
encoding
}
and
\var
{
errors
}
have the same
string
\var
{
s
}
.
\var
{
encoding
}
and
\var
{
errors
}
have the same
meaning as the parameters of the same name in the
meaning as the parameters of the same name in the
\function
{
unicode()
}
builtin function. The codec to be used is
\function
{
unicode()
}
builtin function. The codec to be used is
looked up using the Python codec registry. Return
s
\NULL
{}
if an
looked up using the Python codec registry. Return
\NULL
{}
if an
exception was raised by the codec.
exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1050,22 +1050,22 @@ These are the generic codec APIs:
...
@@ -1050,22 +1050,22 @@ These are the generic codec APIs:
int size,
int size,
const char *encoding,
const char *encoding,
const char *errors
}
const char *errors
}
Encode
s the
\ctype
{
Py
_
UNICODE
}
buffer of the given size and returns
Encode
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size and return
a Python string object.
\var
{
encoding
}
and
\var
{
errors
}
have the
a Python string object.
\var
{
encoding
}
and
\var
{
errors
}
have the
same meaning as the parameters of the same name in the Unicode
same meaning as the parameters of the same name in the Unicode
\method
{
encode()
}
method. The codec to be used is looked up using
\method
{
encode()
}
method. The codec to be used is looked up using
the Python codec registry. Return
s
\NULL
{}
if an exception was
the Python codec registry. Return
\NULL
{}
if an exception was
raised by the codec.
raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsEncodedString
}{
PyObject *unicode,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsEncodedString
}{
PyObject *unicode,
const char *encoding,
const char *encoding,
const char *errors
}
const char *errors
}
Encode
s a Unicode object and returns
the result as Python string
Encode
a Unicode object and return
the result as Python string
object.
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
object.
\var
{
encoding
}
and
\var
{
errors
}
have the same meaning as the
parameters of the same name in the Unicode
\method
{
encode()
}
method.
parameters of the same name in the Unicode
\method
{
encode()
}
method.
The codec to be used is looked up using the Python codec registry.
The codec to be used is looked up using the Python codec registry.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
% --- UTF-8 Codecs -------------------------------------------------------
% --- UTF-8 Codecs -------------------------------------------------------
...
@@ -1075,8 +1075,8 @@ These are the UTF-8 codec APIs:
...
@@ -1075,8 +1075,8 @@ These are the UTF-8 codec APIs:
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeUTF8
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeUTF8
}{
const char *s,
int size,
int size,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the UTF-8
Create a Unicode object by decoding
\var
{
size
}
bytes of the UTF-8
encoded string
\var
{
s
}
. Return
s
\NULL
{}
if an exception was raised
encoded string
\var
{
s
}
. Return
\NULL
{}
if an exception was raised
by the codec.
by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1084,7 +1084,7 @@ These are the UTF-8 codec APIs:
...
@@ -1084,7 +1084,7 @@ These are the UTF-8 codec APIs:
int size,
int size,
const char *errors,
const char *errors,
int *consumed
}
int *consumed
}
If
\var
{
consumed
}
is
\NULL
{}
, behave
s
like
\cfunction
{
PyUnicode
_
DecodeUTF8()
}
.
If
\var
{
consumed
}
is
\NULL
{}
, behave like
\cfunction
{
PyUnicode
_
DecodeUTF8()
}
.
If
\var
{
consumed
}
is not
\NULL
{}
, trailing incomplete UTF-8 byte sequences
If
\var
{
consumed
}
is not
\NULL
{}
, trailing incomplete UTF-8 byte sequences
will not be treated as an error. Those bytes will not be decoded and the
will not be treated as an error. Those bytes will not be decoded and the
number of bytes that have been decoded will be stored in
\var
{
consumed
}
.
number of bytes that have been decoded will be stored in
\var
{
consumed
}
.
...
@@ -1094,14 +1094,14 @@ These are the UTF-8 codec APIs:
...
@@ -1094,14 +1094,14 @@ These are the UTF-8 codec APIs:
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeUTF8
}{
const Py
_
UNICODE *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeUTF8
}{
const Py
_
UNICODE *s,
int size,
int size,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using UTF-8
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using UTF-8
and return
s a Python string object. Returns
\NULL
{}
if an exception
and return
a Python string object. Return
\NULL
{}
if an exception
was raised by the codec.
was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsUTF8String
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsUTF8String
}{
PyObject *unicode
}
Encode
s a Unicode objects using UTF-8 and returns
the result as
Encode
a Unicode objects using UTF-8 and return
the result as
Python string object. Error handling is ``strict''. Return
s
Python string object. Error handling is ``strict''. Return
\NULL
{}
if an exception was raised by the codec.
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1113,8 +1113,8 @@ These are the UTF-16 codec APIs:
...
@@ -1113,8 +1113,8 @@ These are the UTF-16 codec APIs:
int size,
int size,
const char *errors,
const char *errors,
int *byteorder
}
int *byteorder
}
Decode
s
\var
{
length
}
bytes from a UTF-16 encoded buffer string and
Decode
\var
{
length
}
bytes from a UTF-16 encoded buffer string and
return
s
the corresponding Unicode object.
\var
{
errors
}
(if
return the corresponding Unicode object.
\var
{
errors
}
(if
non-
\NULL
{}
) defines the error handling. It defaults to ``strict''.
non-
\NULL
{}
) defines the error handling. It defaults to ``strict''.
If
\var
{
byteorder
}
is non-
\NULL
{}
, the decoder starts decoding using
If
\var
{
byteorder
}
is non-
\NULL
{}
, the decoder starts decoding using
...
@@ -1133,7 +1133,7 @@ These are the UTF-16 codec APIs:
...
@@ -1133,7 +1133,7 @@ These are the UTF-16 codec APIs:
If
\var
{
byteorder
}
is
\NULL
{}
, the codec starts in native order mode.
If
\var
{
byteorder
}
is
\NULL
{}
, the codec starts in native order mode.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeUTF16Stateful
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeUTF16Stateful
}{
const char *s,
...
@@ -1141,7 +1141,7 @@ These are the UTF-16 codec APIs:
...
@@ -1141,7 +1141,7 @@ These are the UTF-16 codec APIs:
const char *errors,
const char *errors,
int *byteorder,
int *byteorder,
int *consumed
}
int *consumed
}
If
\var
{
consumed
}
is
\NULL
{}
, behave
s
like
If
\var
{
consumed
}
is
\NULL
{}
, behave like
\cfunction
{
PyUnicode
_
DecodeUTF16()
}
. If
\var
{
consumed
}
is not
\NULL
{}
,
\cfunction
{
PyUnicode
_
DecodeUTF16()
}
. If
\var
{
consumed
}
is not
\NULL
{}
,
\cfunction
{
PyUnicode
_
DecodeUTF16Stateful()
}
will not treat trailing incomplete
\cfunction
{
PyUnicode
_
DecodeUTF16Stateful()
}
will not treat trailing incomplete
UTF-16 byte sequences (such as an odd number of bytes or a split surrogate pair)
UTF-16 byte sequences (such as an odd number of bytes or a split surrogate pair)
...
@@ -1154,7 +1154,7 @@ These are the UTF-16 codec APIs:
...
@@ -1154,7 +1154,7 @@ These are the UTF-16 codec APIs:
int size,
int size,
const char *errors,
const char *errors,
int byteorder
}
int byteorder
}
Return
s
a Python string object holding the UTF-16 encoded value of
Return a Python string object holding the UTF-16 encoded value of
the Unicode data in
\var
{
s
}
. If
\var
{
byteorder
}
is not
\code
{
0
}
,
the Unicode data in
\var
{
s
}
. If
\var
{
byteorder
}
is not
\code
{
0
}
,
output is written according to the following byte order:
output is written according to the following byte order:
...
@@ -1173,13 +1173,13 @@ These are the UTF-16 codec APIs:
...
@@ -1173,13 +1173,13 @@ These are the UTF-16 codec APIs:
defined, each
\ctype
{
Py
_
UNICODE
}
values is interpreted as an
defined, each
\ctype
{
Py
_
UNICODE
}
values is interpreted as an
UCS-2 character.
UCS-2 character.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsUTF16String
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsUTF16String
}{
PyObject *unicode
}
Return
s
a Python string using the UTF-16 encoding in native byte
Return a Python string using the UTF-16 encoding in native byte
order. The string always starts with a BOM mark. Error handling is
order. The string always starts with a BOM mark. Error handling is
``strict''. Return
s
\NULL
{}
if an exception was raised by the
``strict''. Return
\NULL
{}
if an exception was raised by the
codec.
codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1190,23 +1190,23 @@ These are the ``Unicode Escape'' codec APIs:
...
@@ -1190,23 +1190,23 @@ These are the ``Unicode Escape'' codec APIs:
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeUnicodeEscape
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeUnicodeEscape
}{
const char *s,
int size,
int size,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the
Create a Unicode object by decoding
\var
{
size
}
bytes of the
Unicode-Escape encoded string
\var
{
s
}
. Return
s
\NULL
{}
if an
Unicode-Escape encoded string
\var
{
s
}
. Return
\NULL
{}
if an
exception was raised by the codec.
exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeUnicodeEscape
}{
const Py
_
UNICODE *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeUnicodeEscape
}{
const Py
_
UNICODE *s,
int size,
int size,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Unicode-Escape and return
s a Python string object. Returns
\NULL
{}
Unicode-Escape and return
a Python string object. Return
\NULL
{}
if an exception was raised by the codec.
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsUnicodeEscapeString
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsUnicodeEscapeString
}{
PyObject *unicode
}
Encode
s a Unicode objects using Unicode-Escape and returns
the
Encode
a Unicode objects using Unicode-Escape and return
the
result as Python string object. Error handling is ``strict''.
result as Python string object. Error handling is ``strict''.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
% --- Raw-Unicode-Escape Codecs ------------------------------------------
% --- Raw-Unicode-Escape Codecs ------------------------------------------
...
@@ -1216,23 +1216,23 @@ These are the ``Raw Unicode Escape'' codec APIs:
...
@@ -1216,23 +1216,23 @@ These are the ``Raw Unicode Escape'' codec APIs:
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeRawUnicodeEscape
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeRawUnicodeEscape
}{
const char *s,
int size,
int size,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the
Create a Unicode object by decoding
\var
{
size
}
bytes of the
Raw-Unicode-Escape encoded string
\var
{
s
}
. Return
s
\NULL
{}
if an
Raw-Unicode-Escape encoded string
\var
{
s
}
. Return
\NULL
{}
if an
exception was raised by the codec.
exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeRawUnicodeEscape
}{
const Py
_
UNICODE *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeRawUnicodeEscape
}{
const Py
_
UNICODE *s,
int size,
int size,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Raw-Unicode-Escape and return
s a Python string object. Returns
Raw-Unicode-Escape and return
a Python string object. Return
\NULL
{}
if an exception was raised by the codec.
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsRawUnicodeEscapeString
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsRawUnicodeEscapeString
}{
PyObject *unicode
}
Encode
s a Unicode objects using Raw-Unicode-Escape and returns
the
Encode
a Unicode objects using Raw-Unicode-Escape and return
the
result as Python string object. Error handling is ``strict''.
result as Python string object. Error handling is ``strict''.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
% --- Latin-1 Codecs -----------------------------------------------------
% --- Latin-1 Codecs -----------------------------------------------------
...
@@ -1244,22 +1244,22 @@ are accepted by the codecs during encoding.
...
@@ -1244,22 +1244,22 @@ are accepted by the codecs during encoding.
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeLatin1
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeLatin1
}{
const char *s,
int size,
int size,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the Latin-1
Create a Unicode object by decoding
\var
{
size
}
bytes of the Latin-1
encoded string
\var
{
s
}
. Return
s
\NULL
{}
if an exception was raised
encoded string
\var
{
s
}
. Return
\NULL
{}
if an exception was raised
by the codec.
by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeLatin1
}{
const Py
_
UNICODE *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeLatin1
}{
const Py
_
UNICODE *s,
int size,
int size,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Latin-1 and return
s a Python string object. Returns
\NULL
{}
if an
Latin-1 and return
a Python string object. Return
\NULL
{}
if an
exception was raised by the codec.
exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsLatin1String
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsLatin1String
}{
PyObject *unicode
}
Encode
s a Unicode objects using Latin-1 and returns
the result as
Encode
a Unicode objects using Latin-1 and return
the result as
Python string object. Error handling is ``strict''. Return
s
Python string object. Error handling is ``strict''. Return
\NULL
{}
if an exception was raised by the codec.
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1271,22 +1271,22 @@ accepted. All other codes generate errors.
...
@@ -1271,22 +1271,22 @@ accepted. All other codes generate errors.
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeASCII
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeASCII
}{
const char *s,
int size,
int size,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the
Create a Unicode object by decoding
\var
{
size
}
bytes of the
\ASCII
{}
encoded string
\var
{
s
}
. Return
s
\NULL
{}
if an exception
\ASCII
{}
encoded string
\var
{
s
}
. Return
\NULL
{}
if an exception
was raised by the codec.
was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeASCII
}{
const Py
_
UNICODE *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeASCII
}{
const Py
_
UNICODE *s,
int size,
int size,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using
\ASCII
{}
and return
s a Python string object. Returns
\NULL
{}
if an
\ASCII
{}
and return
a Python string object. Return
\NULL
{}
if an
exception was raised by the codec.
exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsASCIIString
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsASCIIString
}{
PyObject *unicode
}
Encode
s a Unicode objects using
\ASCII
{}
and returns
the result as
Encode
a Unicode objects using
\ASCII
{}
and return
the result as
Python string object. Error handling is ``strict''. Return
s
Python string object. Error handling is ``strict''. Return
\NULL
{}
if an exception was raised by the codec.
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1320,8 +1320,8 @@ points.
...
@@ -1320,8 +1320,8 @@ points.
int size,
int size,
PyObject *mapping,
PyObject *mapping,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the encoded
Create a Unicode object by decoding
\var
{
size
}
bytes of the encoded
string
\var
{
s
}
using the given
\var
{
mapping
}
object. Return
s
string
\var
{
s
}
using the given
\var
{
mapping
}
object. Return
\NULL
{}
if an exception was raised by the codec.
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1329,16 +1329,16 @@ points.
...
@@ -1329,16 +1329,16 @@ points.
int size,
int size,
PyObject *mapping,
PyObject *mapping,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using the
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using the
given
\var
{
mapping
}
object and return
s
a Python string object.
given
\var
{
mapping
}
object and return a Python string object.
Return
s
\NULL
{}
if an exception was raised by the codec.
Return
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsCharmapString
}{
PyObject *unicode,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsCharmapString
}{
PyObject *unicode,
PyObject *mapping
}
PyObject *mapping
}
Encode
s
a Unicode objects using the given
\var
{
mapping
}
object and
Encode a Unicode objects using the given
\var
{
mapping
}
object and
return
s
the result as Python string object. Error handling is
return the result as Python string object. Error handling is
``strict''. Return
s
\NULL
{}
if an exception was raised by the
``strict''. Return
\NULL
{}
if an exception was raised by the
codec.
codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1348,9 +1348,9 @@ The following codec API is special in that maps Unicode to Unicode.
...
@@ -1348,9 +1348,9 @@ The following codec API is special in that maps Unicode to Unicode.
int size,
int size,
PyObject *table,
PyObject *table,
const char *errors
}
const char *errors
}
Translate
s
a
\ctype
{
Py
_
UNICODE
}
buffer of the given length by
Translate a
\ctype
{
Py
_
UNICODE
}
buffer of the given length by
applying a character mapping
\var
{
table
}
to it and return
s
the
applying a character mapping
\var
{
table
}
to it and return the
resulting Unicode object. Return
s
\NULL
{}
when an exception was
resulting Unicode object. Return
\NULL
{}
when an exception was
raised by the codec.
raised by the codec.
The
\var
{
mapping
}
table must map Unicode ordinal integers to Unicode
The
\var
{
mapping
}
table must map Unicode ordinal integers to Unicode
...
@@ -1373,22 +1373,22 @@ machine running the codec.
...
@@ -1373,22 +1373,22 @@ machine running the codec.
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeMBCS
}{
const char *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
DecodeMBCS
}{
const char *s,
int size,
int size,
const char *errors
}
const char *errors
}
Create
s
a Unicode object by decoding
\var
{
size
}
bytes of the MBCS
Create a Unicode object by decoding
\var
{
size
}
bytes of the MBCS
encoded string
\var
{
s
}
. Return
s
\NULL
{}
if an exception was
encoded string
\var
{
s
}
. Return
\NULL
{}
if an exception was
raised by the codec.
raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeMBCS
}{
const Py
_
UNICODE *s,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
EncodeMBCS
}{
const Py
_
UNICODE *s,
int size,
int size,
const char *errors
}
const char *errors
}
Encode
s
the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using MBCS
Encode the
\ctype
{
Py
_
UNICODE
}
buffer of the given size using MBCS
and return
s a Python string object. Returns
\NULL
{}
if an exception
and return
a Python string object. Return
\NULL
{}
if an exception
was raised by the codec.
was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsMBCSString
}{
PyObject *unicode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
AsMBCSString
}{
PyObject *unicode
}
Encode
s a Unicode objects using MBCS and returns
the result as
Encode
a Unicode objects using MBCS and return
the result as
Python string object. Error handling is ``strict''. Return
s
Python string object. Error handling is ``strict''. Return
\NULL
{}
if an exception was raised by the codec.
\NULL
{}
if an exception was raised by the codec.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1457,7 +1457,7 @@ They all return \NULL{} or \code{-1} if an exception occurs.
...
@@ -1457,7 +1457,7 @@ They all return \NULL{} or \code{-1} if an exception occurs.
Return 1 if
\var
{
substr
}
matches
\var
{
str
}
[
\var
{
start
}
:
\var
{
end
}
] at
Return 1 if
\var
{
substr
}
matches
\var
{
str
}
[
\var
{
start
}
:
\var
{
end
}
] at
the given tail end (
\var
{
direction
}
== -1 means to do a prefix
the given tail end (
\var
{
direction
}
== -1 means to do a prefix
match,
\var
{
direction
}
== 1 a suffix match), 0 otherwise.
match,
\var
{
direction
}
== 1 a suffix match), 0 otherwise.
Return
s
\code
{
-1
}
if an error occurred.
Return
\code
{
-1
}
if an error occurred.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
Find
}{
PyObject *str,
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
Find
}{
PyObject *str,
...
@@ -1479,7 +1479,7 @@ They all return \NULL{} or \code{-1} if an exception occurs.
...
@@ -1479,7 +1479,7 @@ They all return \NULL{} or \code{-1} if an exception occurs.
int start,
int start,
int end
}
int end
}
Return the number of non-overlapping occurrences of
\var
{
substr
}
in
Return the number of non-overlapping occurrences of
\var
{
substr
}
in
\code
{
\var
{
str
}
[
\var
{
start
}
:
\var
{
end
}
]
}
. Return
s
\code
{
-1
}
if an
\code
{
\var
{
str
}
[
\var
{
start
}
:
\var
{
end
}
]
}
. Return
\code
{
-1
}
if an
error occurred.
error occurred.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1499,15 +1499,15 @@ They all return \NULL{} or \code{-1} if an exception occurs.
...
@@ -1499,15 +1499,15 @@ They all return \NULL{} or \code{-1} if an exception occurs.
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
Format
}{
PyObject *format,
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
Format
}{
PyObject *format,
PyObject *args
}
PyObject *args
}
Return
s
a new string object from
\var
{
format
}
and
\var
{
args
}
; this
Return a new string object from
\var
{
format
}
and
\var
{
args
}
; this
is analogous to
\code
{
\var
{
format
}
\%\ \var
{
args
}}
. The
is analogous to
\code
{
\var
{
format
}
\%\ \var
{
args
}}
. The
\var
{
args
}
argument must be a tuple.
\var
{
args
}
argument must be a tuple.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
Contains
}{
PyObject *container,
\begin{cfuncdesc}
{
int
}{
PyUnicode
_
Contains
}{
PyObject *container,
PyObject *element
}
PyObject *element
}
Check
s
whether
\var
{
element
}
is contained in
\var
{
container
}
and
Check whether
\var
{
element
}
is contained in
\var
{
container
}
and
return
s
true or false accordingly.
return true or false accordingly.
\var
{
element
}
has to coerce to a one element Unicode
\var
{
element
}
has to coerce to a one element Unicode
string.
\code
{
-1
}
is returned if there was an error.
string.
\code
{
-1
}
is returned if there was an error.
...
@@ -1623,7 +1623,7 @@ format.
...
@@ -1623,7 +1623,7 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
New
}{
int size
}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
New
}{
int size
}
Return
s
a new writable buffer object that maintains its own memory
Return a new writable buffer object that maintains its own memory
buffer of
\var
{
size
}
bytes.
\exception
{
ValueError
}
is returned if
buffer of
\var
{
size
}
bytes.
\exception
{
ValueError
}
is returned if
\var
{
size
}
is not zero or positive. Note that the memory buffer (as
\var
{
size
}
is not zero or positive. Note that the memory buffer (as
returned by
\cfunction
{
PyObject
_
AsWriteBuffer()
}
) is not specifically
returned by
\cfunction
{
PyObject
_
AsWriteBuffer()
}
) is not specifically
...
@@ -1669,7 +1669,7 @@ format.
...
@@ -1669,7 +1669,7 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyTuple
_
Size
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyTuple
_
Size
}{
PyObject *p
}
Take
s a pointer to a tuple object, and returns
the size of that
Take
a pointer to a tuple object, and return
the size of that
tuple.
tuple.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1679,8 +1679,8 @@ format.
...
@@ -1679,8 +1679,8 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyTuple
_
GetItem
}{
PyObject *p, int pos
}
\begin{cfuncdesc}
{
PyObject*
}{
PyTuple
_
GetItem
}{
PyObject *p, int pos
}
Return
s
the object at position
\var
{
pos
}
in the tuple pointed to by
Return the object at position
\var
{
pos
}
in the tuple pointed to by
\var
{
p
}
. If
\var
{
pos
}
is out of bounds, return
s
\NULL
{}
and sets an
\var
{
p
}
. If
\var
{
pos
}
is out of bounds, return
\NULL
{}
and sets an
\exception
{
IndexError
}
exception.
\exception
{
IndexError
}
exception.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1691,14 +1691,14 @@ format.
...
@@ -1691,14 +1691,14 @@ format.
\begin{cfuncdesc}
{
PyObject*
}{
PyTuple
_
GetSlice
}{
PyObject *p,
\begin{cfuncdesc}
{
PyObject*
}{
PyTuple
_
GetSlice
}{
PyObject *p,
int low, int high
}
int low, int high
}
Take
s
a slice of the tuple pointed to by
\var
{
p
}
from
\var
{
low
}
to
Take a slice of the tuple pointed to by
\var
{
p
}
from
\var
{
low
}
to
\var
{
high
}
and return
s
it as a new tuple.
\var
{
high
}
and return it as a new tuple.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyTuple
_
SetItem
}{
PyObject *p,
\begin{cfuncdesc}
{
int
}{
PyTuple
_
SetItem
}{
PyObject *p,
int pos, PyObject *o
}
int pos, PyObject *o
}
Insert
s
a reference to object
\var
{
o
}
at position
\var
{
pos
}
of the
Insert a reference to object
\var
{
o
}
at position
\var
{
pos
}
of the
tuple pointed to by
\var
{
p
}
.
It returns
\code
{
0
}
on success.
tuple pointed to by
\var
{
p
}
.
Return
\code
{
0
}
on success.
\note
{
This function ``steals'' a reference to
\var
{
o
}
.
}
\note
{
This function ``steals'' a reference to
\var
{
o
}
.
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1742,7 +1742,7 @@ format.
...
@@ -1742,7 +1742,7 @@ format.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyList
_
Check
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a list object or an instance of a
Return true if
\var
{
p
}
is a list object or an instance of a
subtype of the list type.
subtype of the list type.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1754,12 +1754,12 @@ format.
...
@@ -1754,12 +1754,12 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
New
}{
int len
}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
New
}{
int len
}
Return
s
a new list of length
\var
{
len
}
on success, or
\NULL
{}
on
Return a new list of length
\var
{
len
}
on success, or
\NULL
{}
on
failure.
failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Size
}{
PyObject *list
}
\begin{cfuncdesc}
{
int
}{
PyList
_
Size
}{
PyObject *list
}
Return
s
the length of the list object in
\var
{
list
}
; this is
Return the length of the list object in
\var
{
list
}
; this is
equivalent to
\samp
{
len(
\var
{
list
}
)
}
on a list object.
equivalent to
\samp
{
len(
\var
{
list
}
)
}
on a list object.
\bifuncindex
{
len
}
\bifuncindex
{
len
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1769,8 +1769,8 @@ format.
...
@@ -1769,8 +1769,8 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetItem
}{
PyObject *list, int index
}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetItem
}{
PyObject *list, int index
}
Return
s
the object at position
\var
{
pos
}
in the list pointed to by
Return the object at position
\var
{
pos
}
in the list pointed to by
\var
{
p
}
. If
\var
{
pos
}
is out of bounds, return
s
\NULL
{}
and sets
an
\var
{
p
}
. If
\var
{
pos
}
is out of bounds, return
\NULL
{}
and set
an
\exception
{
IndexError
}
exception.
\exception
{
IndexError
}
exception.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1780,7 +1780,7 @@ format.
...
@@ -1780,7 +1780,7 @@ format.
\begin{cfuncdesc}
{
int
}{
PyList
_
SetItem
}{
PyObject *list, int index,
\begin{cfuncdesc}
{
int
}{
PyList
_
SetItem
}{
PyObject *list, int index,
PyObject *item
}
PyObject *item
}
Set
s the item at index
\var
{
index
}
in list to
\var
{
item
}
. Returns
Set
the item at index
\var
{
index
}
in list to
\var
{
item
}
. Return
\code
{
0
}
on success or
\code
{
-1
}
on failure.
\note
{
This function
\code
{
0
}
on success or
\code
{
-1
}
on failure.
\note
{
This function
``steals'' a reference to
\var
{
item
}
and discards a reference to an
``steals'' a reference to
\var
{
item
}
and discards a reference to an
item already in the list at the affected position.
}
item already in the list at the affected position.
}
...
@@ -1799,23 +1799,23 @@ format.
...
@@ -1799,23 +1799,23 @@ format.
\begin{cfuncdesc}
{
int
}{
PyList
_
Insert
}{
PyObject *list, int index,
\begin{cfuncdesc}
{
int
}{
PyList
_
Insert
}{
PyObject *list, int index,
PyObject *item
}
PyObject *item
}
Insert
s
the item
\var
{
item
}
into list
\var
{
list
}
in front of index
Insert the item
\var
{
item
}
into list
\var
{
list
}
in front of index
\var
{
index
}
. Return
s
\code
{
0
}
if successful; returns
\code
{
-1
}
and
\var
{
index
}
. Return
\code
{
0
}
if successful; return
\code
{
-1
}
and
raises
an exception if unsuccessful. Analogous to
set
an exception if unsuccessful. Analogous to
\code
{
\var
{
list
}
.insert(
\var
{
index
}
,
\var
{
item
}
)
}
.
\code
{
\var
{
list
}
.insert(
\var
{
index
}
,
\var
{
item
}
)
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Append
}{
PyObject *list, PyObject *item
}
\begin{cfuncdesc}
{
int
}{
PyList
_
Append
}{
PyObject *list, PyObject *item
}
Append
s
the object
\var
{
item
}
at the end of list
\var
{
list
}
.
Append the object
\var
{
item
}
at the end of list
\var
{
list
}
.
Return
s
\code
{
0
}
if successful; returns
\code
{
-1
}
and sets
an
Return
\code
{
0
}
if successful; return
\code
{
-1
}
and set
an
exception if unsuccessful. Analogous to
exception if unsuccessful. Analogous to
\code
{
\var
{
list
}
.append(
\var
{
item
}
)
}
.
\code
{
\var
{
list
}
.append(
\var
{
item
}
)
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetSlice
}{
PyObject *list,
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
GetSlice
}{
PyObject *list,
int low, int high
}
int low, int high
}
Return
s
a list of the objects in
\var
{
list
}
containing the objects
Return a list of the objects in
\var
{
list
}
containing the objects
\emph
{
between
}
\var
{
low
}
and
\var
{
high
}
. Return
s
\NULL
{}
and sets
\emph
{
between
}
\var
{
low
}
and
\var
{
high
}
. Return
\NULL
{}
and set
an exception if unsuccessful.
an exception if unsuccessful.
Analogous to
\code
{
\var
{
list
}
[
\var
{
low
}
:
\var
{
high
}
]
}
.
Analogous to
\code
{
\var
{
list
}
[
\var
{
low
}
:
\var
{
high
}
]
}
.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1823,28 +1823,28 @@ format.
...
@@ -1823,28 +1823,28 @@ format.
\begin{cfuncdesc}
{
int
}{
PyList
_
SetSlice
}{
PyObject *list,
\begin{cfuncdesc}
{
int
}{
PyList
_
SetSlice
}{
PyObject *list,
int low, int high,
int low, int high,
PyObject *itemlist
}
PyObject *itemlist
}
Set
s
the slice of
\var
{
list
}
between
\var
{
low
}
and
\var
{
high
}
to the
Set the slice of
\var
{
list
}
between
\var
{
low
}
and
\var
{
high
}
to the
contents of
\var
{
itemlist
}
. Analogous to
contents of
\var
{
itemlist
}
. Analogous to
\code
{
\var
{
list
}
[
\var
{
low
}
:
\var
{
high
}
] =
\var
{
itemlist
}}
.
\code
{
\var
{
list
}
[
\var
{
low
}
:
\var
{
high
}
] =
\var
{
itemlist
}}
.
The
\var
{
itemlist
}
may be
\NULL
{}
, indicating the assignment
The
\var
{
itemlist
}
may be
\NULL
{}
, indicating the assignment
of an empty list (slice deletion).
of an empty list (slice deletion).
Return
s
\code
{
0
}
on success,
\code
{
-1
}
on failure.
Return
\code
{
0
}
on success,
\code
{
-1
}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Sort
}{
PyObject *list
}
\begin{cfuncdesc}
{
int
}{
PyList
_
Sort
}{
PyObject *list
}
Sort
s the items of
\var
{
list
}
in place. Returns
\code
{
0
}
on
Sort
the items of
\var
{
list
}
in place. Return
\code
{
0
}
on
success,
\code
{
-1
}
on failure. This is equivalent to
success,
\code
{
-1
}
on failure. This is equivalent to
\samp
{
\var
{
list
}
.sort()
}
.
\samp
{
\var
{
list
}
.sort()
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyList
_
Reverse
}{
PyObject *list
}
\begin{cfuncdesc}
{
int
}{
PyList
_
Reverse
}{
PyObject *list
}
Reverse
s the items of
\var
{
list
}
in place. Returns
\code
{
0
}
on
Reverse
the items of
\var
{
list
}
in place. Return
\code
{
0
}
on
success,
\code
{
-1
}
on failure. This is the equivalent of
success,
\code
{
-1
}
on failure. This is the equivalent of
\samp
{
\var
{
list
}
.reverse()
}
.
\samp
{
\var
{
list
}
.reverse()
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
AsTuple
}{
PyObject *list
}
\begin{cfuncdesc}
{
PyObject*
}{
PyList
_
AsTuple
}{
PyObject *list
}
Return
s
a new tuple object containing the contents of
\var
{
list
}
;
Return a new tuple object containing the contents of
\var
{
list
}
;
equivalent to
\samp
{
tuple(
\var
{
list
}
)
}
.
\bifuncindex
{
tuple
}
equivalent to
\samp
{
tuple(
\var
{
list
}
)
}
.
\bifuncindex
{
tuple
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1870,7 +1870,7 @@ format.
...
@@ -1870,7 +1870,7 @@ format.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Check
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a dict object or an instance of a
Return true if
\var
{
p
}
is a dict object or an instance of a
subtype of the dict type.
subtype of the dict type.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1882,7 +1882,7 @@ format.
...
@@ -1882,7 +1882,7 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
New
}{}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
New
}{}
Return
s
a new empty dictionary, or
\NULL
{}
on failure.
Return a new empty dictionary, or
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDictProxy
_
New
}{
PyObject *dict
}
\begin{cfuncdesc}
{
PyObject*
}{
PyDictProxy
_
New
}{
PyObject *dict
}
...
@@ -1893,7 +1893,7 @@ format.
...
@@ -1893,7 +1893,7 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
void
}{
PyDict
_
Clear
}{
PyObject *p
}
\begin{cfuncdesc}
{
void
}{
PyDict
_
Clear
}{
PyObject *p
}
Empt
ies
an existing dictionary of all key-value pairs.
Empt
y
an existing dictionary of all key-value pairs.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Contains
}{
PyObject *p, PyObject *key
}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Contains
}{
PyObject *p, PyObject *key
}
...
@@ -1905,44 +1905,44 @@ format.
...
@@ -1905,44 +1905,44 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Copy
}{
PyObject *p
}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Copy
}{
PyObject *p
}
Return
s
a new dictionary that contains the same key-value pairs as
Return a new dictionary that contains the same key-value pairs as
\var
{
p
}
.
\var
{
p
}
.
\versionadded
{
1.6
}
\versionadded
{
1.6
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
SetItem
}{
PyObject *p, PyObject *key,
\begin{cfuncdesc}
{
int
}{
PyDict
_
SetItem
}{
PyObject *p, PyObject *key,
PyObject *val
}
PyObject *val
}
Insert
s
\var
{
value
}
into the dictionary
\var
{
p
}
with a key of
Insert
\var
{
value
}
into the dictionary
\var
{
p
}
with a key of
\var
{
key
}
.
\var
{
key
}
must be hashable; if it isn't,
\var
{
key
}
.
\var
{
key
}
must be hashable; if it isn't,
\exception
{
TypeError
}
will be raised.
\exception
{
TypeError
}
will be raised.
Return
s
\code
{
0
}
on success or
\code
{
-1
}
on failure.
Return
\code
{
0
}
on success or
\code
{
-1
}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
SetItemString
}{
PyObject *p,
\begin{cfuncdesc}
{
int
}{
PyDict
_
SetItemString
}{
PyObject *p,
char *key,
char *key,
PyObject *val
}
PyObject *val
}
Insert
s
\var
{
value
}
into the dictionary
\var
{
p
}
using
\var
{
key
}
as a
Insert
\var
{
value
}
into the dictionary
\var
{
p
}
using
\var
{
key
}
as a
key.
\var
{
key
}
should be a
\ctype
{
char*
}
. The key object is created
key.
\var
{
key
}
should be a
\ctype
{
char*
}
. The key object is created
using
\code
{
PyString
_
FromString(
\var
{
key
}
)
}
. Return
s
\code
{
0
}
on
using
\code
{
PyString
_
FromString(
\var
{
key
}
)
}
. Return
\code
{
0
}
on
success or
\code
{
-1
}
on failure.
success or
\code
{
-1
}
on failure.
\ttindex
{
PyString
_
FromString()
}
\ttindex
{
PyString
_
FromString()
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
DelItem
}{
PyObject *p, PyObject *key
}
\begin{cfuncdesc}
{
int
}{
PyDict
_
DelItem
}{
PyObject *p, PyObject *key
}
Remove
s
the entry in dictionary
\var
{
p
}
with key
\var
{
key
}
.
Remove the entry in dictionary
\var
{
p
}
with key
\var
{
key
}
.
\var
{
key
}
must be hashable; if it isn't,
\exception
{
TypeError
}
is
\var
{
key
}
must be hashable; if it isn't,
\exception
{
TypeError
}
is
raised. Return
s
\code
{
0
}
on success or
\code
{
-1
}
on failure.
raised. Return
\code
{
0
}
on success or
\code
{
-1
}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
DelItemString
}{
PyObject *p, char *key
}
\begin{cfuncdesc}
{
int
}{
PyDict
_
DelItemString
}{
PyObject *p, char *key
}
Remove
s
the entry in dictionary
\var
{
p
}
which has a key specified by
Remove the entry in dictionary
\var
{
p
}
which has a key specified by
the string
\var
{
key
}
. Return
s
\code
{
0
}
on success or
\code
{
-1
}
on
the string
\var
{
key
}
. Return
\code
{
0
}
on success or
\code
{
-1
}
on
failure.
failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
GetItem
}{
PyObject *p, PyObject *key
}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
GetItem
}{
PyObject *p, PyObject *key
}
Return
s
the object from dictionary
\var
{
p
}
which has a key
Return the object from dictionary
\var
{
p
}
which has a key
\var
{
key
}
. Return
s
\NULL
{}
if the key
\var
{
key
}
is not present, but
\var
{
key
}
. Return
\NULL
{}
if the key
\var
{
key
}
is not present, but
\emph
{
without
}
setting an exception.
\emph
{
without
}
setting an exception.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -1952,25 +1952,25 @@ format.
...
@@ -1952,25 +1952,25 @@ format.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Items
}{
PyObject *p
}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Items
}{
PyObject *p
}
Return
s
a
\ctype
{
PyListObject
}
containing all the items from the
Return a
\ctype
{
PyListObject
}
containing all the items from the
dictionary, as in the dictionary method
\method
{
items()
}
(see the
dictionary, as in the dictionary method
\method
{
items()
}
(see the
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Keys
}{
PyObject *p
}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Keys
}{
PyObject *p
}
Return
s
a
\ctype
{
PyListObject
}
containing all the keys from the
Return a
\ctype
{
PyListObject
}
containing all the keys from the
dictionary, as in the dictionary method
\method
{
keys()
}
(see the
dictionary, as in the dictionary method
\method
{
keys()
}
(see the
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Values
}{
PyObject *p
}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Values
}{
PyObject *p
}
Return
s
a
\ctype
{
PyListObject
}
containing all the values from the
Return a
\ctype
{
PyListObject
}
containing all the values from the
dictionary
\var
{
p
}
, as in the dictionary method
\method
{
values()
}
dictionary
\var
{
p
}
, as in the dictionary method
\method
{
values()
}
(see the
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
(see the
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Size
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Size
}{
PyObject *p
}
Return
s
the number of items in the dictionary. This is equivalent
Return the number of items in the dictionary. This is equivalent
to
\samp
{
len(
\var
{
p
}
)
}
on a dictionary.
\bifuncindex
{
len
}
to
\samp
{
len(
\var
{
p
}
)
}
on a dictionary.
\bifuncindex
{
len
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2085,34 +2085,34 @@ implementation detail and may change in future releases of Python.
...
@@ -2085,34 +2085,34 @@ implementation detail and may change in future releases of Python.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyFile
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyFile
_
Check
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyFileObject
}
or a subtype
Return true if its argument is a
\ctype
{
PyFileObject
}
or a subtype
of
\ctype
{
PyFileObject
}
.
of
\ctype
{
PyFileObject
}
.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyFile
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyFile
_
CheckExact
}{
PyObject *p
}
Return
s
true if its argument is a
\ctype
{
PyFileObject
}
, but not a
Return true if its argument is a
\ctype
{
PyFileObject
}
, but not a
subtype of
\ctype
{
PyFileObject
}
.
subtype of
\ctype
{
PyFileObject
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
FromString
}{
char *filename, char *mode
}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
FromString
}{
char *filename, char *mode
}
On success, return
s
a new file object that is opened on the file
On success, return a new file object that is opened on the file
given by
\var
{
filename
}
, with a file mode given by
\var
{
mode
}
, where
given by
\var
{
filename
}
, with a file mode given by
\var
{
mode
}
, where
\var
{
mode
}
has the same semantics as the standard C routine
\var
{
mode
}
has the same semantics as the standard C routine
\cfunction
{
fopen()
}
\ttindex
{
fopen()
}
. On failure, return
s
\NULL
{}
.
\cfunction
{
fopen()
}
\ttindex
{
fopen()
}
. On failure, return
\NULL
{}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
FromFile
}{
FILE *fp,
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
FromFile
}{
FILE *fp,
char *name, char *mode,
char *name, char *mode,
int (*close)(FILE*)
}
int (*close)(FILE*)
}
Create
s
a new
\ctype
{
PyFileObject
}
from the already-open standard C
Create a new
\ctype
{
PyFileObject
}
from the already-open standard C
file pointer,
\var
{
fp
}
. The function
\var
{
close
}
will be called
file pointer,
\var
{
fp
}
. The function
\var
{
close
}
will be called
when the file should be closed. Return
s
\NULL
{}
on failure.
when the file should be closed. Return
\NULL
{}
on failure.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
FILE*
}{
PyFile
_
AsFile
}{
PyFileObject *p
}
\begin{cfuncdesc}
{
FILE*
}{
PyFile
_
AsFile
}{
PyFileObject *p
}
Return
s
the file object associated with
\var
{
p
}
as a
\ctype
{
FILE*
}
.
Return the file object associated with
\var
{
p
}
as a
\ctype
{
FILE*
}
.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
GetLine
}{
PyObject *p, int n
}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
GetLine
}{
PyObject *p, int n
}
...
@@ -2131,7 +2131,7 @@ implementation detail and may change in future releases of Python.
...
@@ -2131,7 +2131,7 @@ implementation detail and may change in future releases of Python.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
Name
}{
PyObject *p
}
\begin{cfuncdesc}
{
PyObject*
}{
PyFile
_
Name
}{
PyObject *p
}
Return
s
the name of the file specified by
\var
{
p
}
as a string
Return the name of the file specified by
\var
{
p
}
as a string
object.
object.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2148,9 +2148,9 @@ implementation detail and may change in future releases of Python.
...
@@ -2148,9 +2148,9 @@ implementation detail and may change in future releases of Python.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyFile
_
SoftSpace
}{
PyObject *p, int newflag
}
\begin{cfuncdesc}
{
int
}{
PyFile
_
SoftSpace
}{
PyObject *p, int newflag
}
This function exists for internal use by the interpreter. Set
s
the
This function exists for internal use by the interpreter. Set the
\member
{
softspace
}
attribute of
\var
{
p
}
to
\var
{
newflag
}
and
\member
{
softspace
}
attribute of
\var
{
p
}
to
\var
{
newflag
}
and
\withsubitem
{
(file attribute)
}{
\ttindex
{
softspace
}}
return
s
the
\withsubitem
{
(file attribute)
}{
\ttindex
{
softspace
}}
return the
previous value.
\var
{
p
}
does not have to be a file object for this
previous value.
\var
{
p
}
does not have to be a file object for this
function to work properly; any object is supported (thought its only
function to work properly; any object is supported (thought its only
interesting if the
\member
{
softspace
}
attribute can be set). This
interesting if the
\member
{
softspace
}
attribute can be set). This
...
@@ -2162,16 +2162,16 @@ implementation detail and may change in future releases of Python.
...
@@ -2162,16 +2162,16 @@ implementation detail and may change in future releases of Python.
\begin{cfuncdesc}
{
int
}{
PyFile
_
WriteObject
}{
PyObject *obj, PyFileObject *p,
\begin{cfuncdesc}
{
int
}{
PyFile
_
WriteObject
}{
PyObject *obj, PyFileObject *p,
int flags
}
int flags
}
Write
s
object
\var
{
obj
}
to file object
\var
{
p
}
. The only supported
Write object
\var
{
obj
}
to file object
\var
{
p
}
. The only supported
flag for
\var
{
flags
}
is
flag for
\var
{
flags
}
is
\constant
{
Py
_
PRINT
_
RAW
}
\ttindex
{
Py
_
PRINT
_
RAW
}
; if given, the
\constant
{
Py
_
PRINT
_
RAW
}
\ttindex
{
Py
_
PRINT
_
RAW
}
; if given, the
\function
{
str()
}
of the object is written instead of the
\function
{
str()
}
of the object is written instead of the
\function
{
repr()
}
. Return
s
\code
{
0
}
on success or
\code
{
-1
}
on
\function
{
repr()
}
. Return
\code
{
0
}
on success or
\code
{
-1
}
on
failure; the appropriate exception will be set.
failure; the appropriate exception will be set.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyFile
_
WriteString
}{
const char *s, PyFileObject *p
}
\begin{cfuncdesc}
{
int
}{
PyFile
_
WriteString
}{
const char *s, PyFileObject *p
}
Write
s string
\var
{
s
}
to file object
\var
{
p
}
. Returns
\code
{
0
}
on
Write
string
\var
{
s
}
to file object
\var
{
p
}
. Return
\code
{
0
}
on
success or
\code
{
-1
}
on failure; the appropriate exception will be
success or
\code
{
-1
}
on failure; the appropriate exception will be
set.
set.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2187,7 +2187,7 @@ There are very few functions specific to instance objects.
...
@@ -2187,7 +2187,7 @@ There are very few functions specific to instance objects.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyInstance
_
Check
}{
PyObject *obj
}
\begin{cfuncdesc}
{
int
}{
PyInstance
_
Check
}{
PyObject *obj
}
Return
s
true if
\var
{
obj
}
is an instance.
Return true if
\var
{
obj
}
is an instance.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyInstance
_
New
}{
PyObject *class,
\begin{cfuncdesc}
{
PyObject*
}{
PyInstance
_
New
}{
PyObject *class,
...
@@ -2278,13 +2278,13 @@ There are only a few functions special to module objects.
...
@@ -2278,13 +2278,13 @@ There are only a few functions special to module objects.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyModule
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyModule
_
Check
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a module object, or a subtype of a module
Return true if
\var
{
p
}
is a module object, or a subtype of a module
object.
object.
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\versionchanged
[Allowed subtypes to be accepted]
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyModule
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyModule
_
CheckExact
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a module object, but not a subtype of
Return true if
\var
{
p
}
is a module object, but not a subtype of
\cdata
{
PyModule
_
Type
}
.
\cdata
{
PyModule
_
Type
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2329,7 +2329,7 @@ There are only a few functions special to module objects.
...
@@ -2329,7 +2329,7 @@ There are only a few functions special to module objects.
char *name, PyObject *value
}
char *name, PyObject *value
}
Add an object to
\var
{
module
}
as
\var
{
name
}
. This is a convenience
Add an object to
\var
{
module
}
as
\var
{
name
}
. This is a convenience
function which can be used from the module's initialization
function which can be used from the module's initialization
function. This steals a reference to
\var
{
value
}
. Return
s
function. This steals a reference to
\var
{
value
}
. Return
\code
{
-1
}
on error,
\code
{
0
}
on success.
\code
{
-1
}
on error,
\code
{
0
}
on success.
\versionadded
{
2.0
}
\versionadded
{
2.0
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2338,7 +2338,7 @@ There are only a few functions special to module objects.
...
@@ -2338,7 +2338,7 @@ There are only a few functions special to module objects.
char *name, long value
}
char *name, long value
}
Add an integer constant to
\var
{
module
}
as
\var
{
name
}
. This
Add an integer constant to
\var
{
module
}
as
\var
{
name
}
. This
convenience function can be used from the module's initialization
convenience function can be used from the module's initialization
function. Return
s
\code
{
-1
}
on error,
\code
{
0
}
on success.
function. Return
\code
{
-1
}
on error,
\code
{
0
}
on success.
\versionadded
{
2.0
}
\versionadded
{
2.0
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2346,7 +2346,7 @@ There are only a few functions special to module objects.
...
@@ -2346,7 +2346,7 @@ There are only a few functions special to module objects.
char *name, char *value
}
char *name, char *value
}
Add a string constant to
\var
{
module
}
as
\var
{
name
}
. This
Add a string constant to
\var
{
module
}
as
\var
{
name
}
. This
convenience function can be used from the module's initialization
convenience function can be used from the module's initialization
function. The string
\var
{
value
}
must be null-terminated. Return
s
function. The string
\var
{
value
}
must be null-terminated. Return
\code
{
-1
}
on error,
\code
{
0
}
on success.
\code
{
-1
}
on error,
\code
{
0
}
on success.
\versionadded
{
2.0
}
\versionadded
{
2.0
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2440,7 +2440,7 @@ They are found in the dictionary of type objects.
...
@@ -2440,7 +2440,7 @@ They are found in the dictionary of type objects.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDescr
_
IsData
}{
PyObject *descr
}
\begin{cfuncdesc}
{
int
}{
PyDescr
_
IsData
}{
PyObject *descr
}
Return
s
true if the descriptor objects
\var
{
descr
}
describes a data
Return true if the descriptor objects
\var
{
descr
}
describes a data
attribute, or false if it describes a method.
\var
{
descr
}
must be a
attribute, or false if it describes a method.
\var
{
descr
}
must be a
descriptor object; there is no error checking.
descriptor object; there is no error checking.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
...
@@ -2460,7 +2460,7 @@ They are found in the dictionary of type objects.
...
@@ -2460,7 +2460,7 @@ They are found in the dictionary of type objects.
\end{cvardesc}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PySlice
_
Check
}{
PyObject *ob
}
\begin{cfuncdesc}
{
int
}{
PySlice
_
Check
}{
PyObject *ob
}
Return
s
true if
\var
{
ob
}
is a slice object;
\var
{
ob
}
must not be
Return true if
\var
{
ob
}
is a slice object;
\var
{
ob
}
must not be
\NULL
{}
.
\NULL
{}
.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2470,7 +2470,7 @@ They are found in the dictionary of type objects.
...
@@ -2470,7 +2470,7 @@ They are found in the dictionary of type objects.
\var
{
stop
}
, and
\var
{
step
}
parameters are used as the values of the
\var
{
stop
}
, and
\var
{
step
}
parameters are used as the values of the
slice object attributes of the same names. Any of the values may be
slice object attributes of the same names. Any of the values may be
\NULL
{}
, in which case the
\code
{
None
}
will be used for the
\NULL
{}
, in which case the
\code
{
None
}
will be used for the
corresponding attribute. Return
s
\NULL
{}
if the new object could
corresponding attribute. Return
\NULL
{}
if the new object could
not be allocated.
not be allocated.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2558,7 +2558,7 @@ acts as a proxy for the original object as much as it can.
...
@@ -2558,7 +2558,7 @@ acts as a proxy for the original object as much as it can.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyWeakref
_
GetObject
}{
PyObject *ref
}
\begin{cfuncdesc}
{
PyObject*
}{
PyWeakref
_
GetObject
}{
PyObject *ref
}
Return
s
the referenced object from a weak reference,
\var
{
ref
}
. If
Return the referenced object from a weak reference,
\var
{
ref
}
. If
the referent is no longer live, returns
\code
{
None
}
.
the referent is no longer live, returns
\code
{
None
}
.
\versionadded
{
2.2
}
\versionadded
{
2.2
}
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2948,34 +2948,34 @@ The following type check macros work on pointers to any Python object.
...
@@ -2948,34 +2948,34 @@ The following type check macros work on pointers to any Python object.
Likewise, the constructor functions work with any iterable Python object.
Likewise, the constructor functions work with any iterable Python object.
\begin{cfuncdesc}
{
int
}{
PyAnySet
_
Check
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyAnySet
_
Check
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a
\class
{
set
}
object, a
\class
{
frozenset
}
Return true if
\var
{
p
}
is a
\class
{
set
}
object, a
\class
{
frozenset
}
object, or an instance of a subtype.
object, or an instance of a subtype.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyAnySet
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyAnySet
_
CheckExact
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a
\class
{
set
}
object or a
\class
{
frozenset
}
Return true if
\var
{
p
}
is a
\class
{
set
}
object or a
\class
{
frozenset
}
object but not an instance of a subtype.
object but not an instance of a subtype.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyFrozenSet
_
CheckExact
}{
PyObject *p
}
\begin{cfuncdesc}
{
int
}{
PyFrozenSet
_
CheckExact
}{
PyObject *p
}
Return
s
true if
\var
{
p
}
is a
\class
{
frozenset
}
object
Return true if
\var
{
p
}
is a
\class
{
frozenset
}
object
but not an instance of a subtype.
but not an instance of a subtype.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PySet
_
New
}{
PyObject *iterable
}
\begin{cfuncdesc}
{
PyObject*
}{
PySet
_
New
}{
PyObject *iterable
}
Return
s
a new
\class
{
set
}
containing objects returned by the
Return a new
\class
{
set
}
containing objects returned by the
\var
{
iterable
}
. The
\var
{
iterable
}
may be
\NULL
{}
to create a
\var
{
iterable
}
. The
\var
{
iterable
}
may be
\NULL
{}
to create a
new empty set. Return
s
the new set on success or
\NULL
{}
on
new empty set. Return the new set on success or
\NULL
{}
on
failure. Raise
s
\exception
{
TypeError
}
if
\var
{
iterable
}
is
failure. Raise
\exception
{
TypeError
}
if
\var
{
iterable
}
is
not actually iterable. The constructor is also useful for
not actually iterable. The constructor is also useful for
copying a set (
\code
{
c=set(s)
}
).
copying a set (
\code
{
c=set(s)
}
).
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyFrozenSet
_
New
}{
PyObject *iterable
}
\begin{cfuncdesc}
{
PyObject*
}{
PyFrozenSet
_
New
}{
PyObject *iterable
}
Return
s
a new
\class
{
frozenset
}
containing objects returned by the
Return a new
\class
{
frozenset
}
containing objects returned by the
\var
{
iterable
}
. The
\var
{
iterable
}
may be
\NULL
{}
to create a
\var
{
iterable
}
. The
\var
{
iterable
}
may be
\NULL
{}
to create a
new empty frozenset. Return
s
the new set on success or
\NULL
{}
on
new empty frozenset. Return the new set on success or
\NULL
{}
on
failure. Raise
s
\exception
{
TypeError
}
if
\var
{
iterable
}
is
failure. Raise
\exception
{
TypeError
}
if
\var
{
iterable
}
is
not actually iterable.
not actually iterable.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -2984,7 +2984,7 @@ The following functions and macros are available for instances of
...
@@ -2984,7 +2984,7 @@ The following functions and macros are available for instances of
\class
{
set
}
or
\class
{
frozenset
}
or instances of their subtypes.
\class
{
set
}
or
\class
{
frozenset
}
or instances of their subtypes.
\begin{cfuncdesc}
{
int
}{
PySet
_
Size
}{
PyObject *anyset
}
\begin{cfuncdesc}
{
int
}{
PySet
_
Size
}{
PyObject *anyset
}
Return
s
the length of a
\class
{
set
}
or
\class
{
frozenset
}
object.
Return the length of a
\class
{
set
}
or
\class
{
frozenset
}
object.
Equivalent to
\samp
{
len(
\var
{
anyset
}
)
}
. Raises a
Equivalent to
\samp
{
len(
\var
{
anyset
}
)
}
. Raises a
\exception
{
PyExc
_
SystemError
}
if
\var
{
anyset
}
is not a
\class
{
set
}
,
\exception
{
PyExc
_
SystemError
}
if
\var
{
anyset
}
is not a
\class
{
set
}
,
\class
{
frozenset
}
, or an instance of a subtype.
\class
{
frozenset
}
, or an instance of a subtype.
...
@@ -2996,11 +2996,11 @@ The following functions and macros are available for instances of
...
@@ -2996,11 +2996,11 @@ The following functions and macros are available for instances of
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PySet
_
Contains
}{
PyObject *anyset, PyObject *key
}
\begin{cfuncdesc}
{
int
}{
PySet
_
Contains
}{
PyObject *anyset, PyObject *key
}
Return
s
1 if found, 0 if not found, and -1 if an error is
Return 1 if found, 0 if not found, and -1 if an error is
encountered. Unlike the Python
\method
{__
contains
__
()
}
method, this
encountered. Unlike the Python
\method
{__
contains
__
()
}
method, this
function does not automatically convert unhashable sets into temporary
function does not automatically convert unhashable sets into temporary
frozensets. Raise
s
a
\exception
{
TypeError
}
if the
\var
{
key
}
is unhashable.
frozensets. Raise a
\exception
{
TypeError
}
if the
\var
{
key
}
is unhashable.
Raise
s
\exception
{
PyExc
_
SystemError
}
if
\var
{
anyset
}
is not a
\class
{
set
}
,
Raise
\exception
{
PyExc
_
SystemError
}
if
\var
{
anyset
}
is not a
\class
{
set
}
,
\class
{
frozenset
}
, or an instance of a subtype.
\class
{
frozenset
}
, or an instance of a subtype.
\end{cfuncdesc}
\end{cfuncdesc}
...
@@ -3009,29 +3009,29 @@ The following functions are available for instances of \class{set} or
...
@@ -3009,29 +3009,29 @@ The following functions are available for instances of \class{set} or
its subtypes but not for instances of
\class
{
frozenset
}
or its subtypes.
its subtypes but not for instances of
\class
{
frozenset
}
or its subtypes.
\begin{cfuncdesc}
{
int
}{
PySet
_
Add
}{
PyObject *set, PyObject *key
}
\begin{cfuncdesc}
{
int
}{
PySet
_
Add
}{
PyObject *set, PyObject *key
}
Add
s
\var
{
key
}
to a
\class
{
set
}
instance. Does not apply to
Add
\var
{
key
}
to a
\class
{
set
}
instance. Does not apply to
\class
{
frozenset
}
instances. Return
s
0 on success or -1 on failure.
\class
{
frozenset
}
instances. Return 0 on success or -1 on failure.
Raise
s
a
\exception
{
TypeError
}
if the
\var
{
key
}
is unhashable.
Raise a
\exception
{
TypeError
}
if the
\var
{
key
}
is unhashable.
Raise
s
a
\exception
{
MemoryError
}
if there is no room to grow.
Raise a
\exception
{
MemoryError
}
if there is no room to grow.
Raise
s
a
\exception
{
SystemError
}
if
\var
{
set
}
is an not an instance
Raise a
\exception
{
SystemError
}
if
\var
{
set
}
is an not an instance
of
\class
{
set
}
or its subtype.
of
\class
{
set
}
or its subtype.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PySet
_
Discard
}{
PyObject *set, PyObject *key
}
\begin{cfuncdesc}
{
int
}{
PySet
_
Discard
}{
PyObject *set, PyObject *key
}
Return
s
1 if found and removed, 0 if not found (no action taken),
Return 1 if found and removed, 0 if not found (no action taken),
and -1 if an error is encountered. Does not raise
\exception
{
KeyError
}
and -1 if an error is encountered. Does not raise
\exception
{
KeyError
}
for missing keys. Raise
s
a
\exception
{
TypeError
}
if the
\var
{
key
}
is
for missing keys. Raise a
\exception
{
TypeError
}
if the
\var
{
key
}
is
unhashable. Unlike the Python
\method
{
discard()
}
method, this function
unhashable. Unlike the Python
\method
{
discard()
}
method, this function
does not automatically convert unhashable sets into temporary frozensets.
does not automatically convert unhashable sets into temporary frozensets.
Raise
s
\exception
{
PyExc
_
SystemError
}
if
\var
{
set
}
is an not an instance
Raise
\exception
{
PyExc
_
SystemError
}
if
\var
{
set
}
is an not an instance
of
\class
{
set
}
or its subtype.
of
\class
{
set
}
or its subtype.
\end{cfuncdesc}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PySet
_
Pop
}{
PyObject *set
}
\begin{cfuncdesc}
{
PyObject*
}{
PySet
_
Pop
}{
PyObject *set
}
Return
s
a new reference to an arbitrary object in the
\var
{
set
}
,
Return a new reference to an arbitrary object in the
\var
{
set
}
,
and removes the object from the
\var
{
set
}
. Return
s
\NULL
{}
on
and removes the object from the
\var
{
set
}
. Return
\NULL
{}
on
failure. Raise
s
\exception
{
KeyError
}
if the set is empty.
failure. Raise
\exception
{
KeyError
}
if the set is empty.
Raise
s
a
\exception
{
SystemError
}
if
\var
{
set
}
is an not an instance
Raise a
\exception
{
SystemError
}
if
\var
{
set
}
is an not an instance
of
\class
{
set
}
or its subtype.
of
\class
{
set
}
or its subtype.
\end{cfuncdesc}
\end{cfuncdesc}
...
...
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