Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c4378b

Browse files
committed
Some patches by Drew Csillag; plus a few of my own uncommitted changes.
1 parent 12d9fc9 commit 3c4378b

2 files changed

Lines changed: 98 additions & 4 deletions

File tree

Doc/api.tex

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ \section{Object Protocol}
10731073
Print an object \var{o}, on file \var{fp}. Returns \code{-1} on error
10741074
The flags argument is used to enable certain printing
10751075
options. The only option currently supported is
1076-
\constant{Py_Print_RAW}.
1076+
\constant{Py_PRINT_RAW}.
10771077
\end{cfuncdesc}
10781078
10791079
\begin{cfuncdesc}{int}{PyObject_HasAttrString}{PyObject *o, char *attr_name}
@@ -1721,28 +1721,40 @@ \subsection{String Objects}
17211721
\end{cvardesc}
17221722
17231723
\begin{cfuncdesc}{int}{PyString_Check}{PyObject *o}
1724-
1724+
Returns true if the object \var{o} is a string object.
17251725
\end{cfuncdesc}
17261726
17271727
\begin{cfuncdesc}{PyObject*}{PyString_FromStringAndSize}{const char *v,
17281728
int len}
1729+
Returns a new string object with the value \var{v} and length
1730+
\var{len} on success, and \NULL{} on failure. If \var{v} is \NULL{},
1731+
the contents of the string are uninitialized.
17291732
\end{cfuncdesc}
17301733
17311734
\begin{cfuncdesc}{PyObject*}{PyString_FromString}{const char *v}
1735+
Returns a new string object with the value \var{v} on success, and
1736+
\NULL{} on failure.
17321737
\end{cfuncdesc}
17331738
17341739
\begin{cfuncdesc}{int}{PyString_Size}{PyObject *string}
1740+
Returns the length of the string in string object \var{string}.
17351741
\end{cfuncdesc}
17361742
17371743
\begin{cfuncdesc}{char*}{PyString_AsString}{PyObject *string}
1744+
Resturns a \NULL{} terminated representation of the contents of \var{string}.
17381745
\end{cfuncdesc}
17391746
17401747
\begin{cfuncdesc}{void}{PyString_Concat}{PyObject **string,
17411748
PyObject *newpart}
1749+
Creates a new string object in \var{*string} containing the contents
1750+
of \var{newpart} appended to \var{string}.
17421751
\end{cfuncdesc}
17431752
17441753
\begin{cfuncdesc}{void}{PyString_ConcatAndDel}{PyObject **string,
17451754
PyObject *newpart}
1755+
Creates a new string object in \var{*string} containing the contents
1756+
of \var{newpart} appended to \var{string}. --WHAT IS THE
1757+
DIFFERENCE BETWEEN THIS AND PLAIN CONCAT?--
17461758
\end{cfuncdesc}
17471759
17481760
\begin{cfuncdesc}{int}{_PyString_Resize}{PyObject **string, int newsize}
@@ -1852,27 +1864,42 @@ \subsection{List Objects}
18521864
\end{cfuncdesc}
18531865
18541866
\begin{cfuncdesc}{PyObject*}{PyList_New}{int size}
1867+
Returns a new list of length \var{len} on success, and \NULL{} on
1868+
failure.
18551869
\end{cfuncdesc}
18561870
18571871
\begin{cfuncdesc}{int}{PyList_Size}{PyObject *list}
1872+
Returns the length of the list object in \var{list}.
18581873
\end{cfuncdesc}
18591874
18601875
\begin{cfuncdesc}{PyObject*}{PyList_GetItem}{PyObject *list, int index}
1876+
Returns the item in \var{list} at index \var{index}.
18611877
\end{cfuncdesc}
18621878
18631879
\begin{cfuncdesc}{int}{PyList_SetItem}{PyObject *list, int index,
18641880
PyObject *item}
1881+
Sets the item at index \var{index} in list to \var{item}.
18651882
\end{cfuncdesc}
18661883
18671884
\begin{cfuncdesc}{int}{PyList_Insert}{PyObject *list, int index,
18681885
PyObject *index}
1886+
Inserts the item \var{item} into list \var{list} in front of index \var{index}
1887+
and returns true if successful.
1888+
For example:
1889+
\begin{verbatim}
1890+
PyList_Insert(list, 0, object);
1891+
\end{verbatim}
18691892
\end{cfuncdesc}
1893+
would insert \var{object} at the front of the list.
18701894
18711895
\begin{cfuncdesc}{int}{PyList_Append}{PyObject *list, PyObject *item}
1896+
Appends the object \var{item} at the end of list \var{list}.
18721897
\end{cfuncdesc}
18731898
18741899
\begin{cfuncdesc}{PyObject*}{PyList_GetSlice}{PyObject *list,
18751900
int low, int high}
1901+
Returns a list of the objects in \var{list} containing the objects
1902+
\emph{between} \var{low} and \var{high}. Analogous to \var{list[low:high]}.
18761903
\end{cfuncdesc}
18771904
18781905
\begin{cfuncdesc}{int}{PyList_SetSlice}{PyObject *list,
@@ -1881,12 +1908,14 @@ \subsection{List Objects}
18811908
\end{cfuncdesc}
18821909
18831910
\begin{cfuncdesc}{int}{PyList_Sort}{PyObject *list}
1911+
18841912
\end{cfuncdesc}
18851913
18861914
\begin{cfuncdesc}{int}{PyList_Reverse}{PyObject *list}
18871915
\end{cfuncdesc}
18881916
18891917
\begin{cfuncdesc}{PyObject*}{PyList_AsTuple}{PyObject *list}
1918+
Returns a new tuple object containing the contents of \var{list}.
18901919
\end{cfuncdesc}
18911920
18921921
\begin{cfuncdesc}{PyObject*}{PyList_GET_ITEM}{PyObject *list, int i}
@@ -2051,21 +2080,29 @@ \subsection{Long Integer Objects}
20512080
\end{cfuncdesc}
20522081
20532082
\begin{cfuncdesc}{PyObject*}{PyLong_FromLong}{long v}
2083+
Returns a new \code{PyLong} object from \var{v}.
20542084
\end{cfuncdesc}
20552085
20562086
\begin{cfuncdesc}{PyObject*}{PyLong_FromUnsignedLong}{unsigned long v}
2087+
Returns a new \code{PyLong} object from an unsigned \C{} long.
20572088
\end{cfuncdesc}
20582089
20592090
\begin{cfuncdesc}{PyObject*}{PyLong_FromDouble}{double v}
2091+
Returns a new \code{PyLong} object from the integer part of \var{v}.
20602092
\end{cfuncdesc}
20612093
20622094
\begin{cfuncdesc}{long}{PyLong_AsLong}{PyObject *pylong}
2095+
Returns a \C{} \code{long} representation of the contents of \var{pylong}.
2096+
WHAT HAPPENS IF \var{pylong} > MAXLONG?
20632097
\end{cfuncdesc}
20642098
20652099
\begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLong}{PyObject *pylong}
2100+
Returns a \C{} \code{unsigned long} representation of the contents of
2101+
\var{pylong}. WHAT HAPPENS IF \var{pylong} > MAXLONG?
20662102
\end{cfuncdesc}
20672103
20682104
\begin{cfuncdesc}{double}{PyLong_AsDouble}{PyObject *pylong}
2105+
Returns a \C{} \code{double} representation of teh contents of \var{pylong}.
20692106
\end{cfuncdesc}
20702107
20712108
\begin{cfuncdesc}{PyObject*}{PyLong_FromString}{char *str, char **pend,
@@ -2091,9 +2128,11 @@ \subsection{Floating Point Objects}
20912128
\end{cfuncdesc}
20922129
20932130
\begin{cfuncdesc}{PyObject*}{PyFloat_FromDouble}{double v}
2131+
Creates a \code{PyFloat} object from \var{v}.
20942132
\end{cfuncdesc}
20952133
20962134
\begin{cfuncdesc}{double}{PyFloat_AsDouble}{PyObject *pyfloat}
2135+
Returns a \C{} \code{double} representation of the contents of \var{pyfloat}.
20972136
\end{cfuncdesc}
20982137
20992138
\begin{cfuncdesc}{double}{PyFloat_AS_DOUBLE}{PyObject *pyfloat}
@@ -2153,12 +2192,15 @@ \subsection{Complex Number Objects}
21532192
\end{cfuncdesc}
21542193
21552194
\begin{cfuncdesc}{PyObject*}{PyComplex_FromDoubles}{double real, double imag}
2195+
Returns a new \code{PyComplex} object from \var{real} and \var{imag}.
21562196
\end{cfuncdesc}
21572197
21582198
\begin{cfuncdesc}{double}{PyComplex_RealAsDouble}{PyObject *op}
2199+
Returns the real part of \var{op} as a \C{} \code{double}.
21592200
\end{cfuncdesc}
21602201
21612202
\begin{cfuncdesc}{double}{PyComplex_ImagAsDouble}{PyObject *op}
2203+
Returns the imaginary part of \var{op} as a \C{} \code{double}.
21622204
\end{cfuncdesc}
21632205
21642206
\begin{cfuncdesc}{Py_complex}{PyComplex_AsCComplex}{PyObject *op}
@@ -2854,6 +2896,11 @@ \chapter{Defining New Object Types}
28542896
\begin{cfuncdesc}{TYPE}{_PyObject_NEW_VAR}{TYPE, PyTypeObject *, int size}
28552897
\end{cfuncdesc}
28562898
2899+
Py_InitModule (!!!)
2900+
2901+
PyArg_ParseTupleAndKeywords, PyArg_ParseTuple, PyArg_Parse
2902+
2903+
Py_BuildValue
28572904
28582905
PyObject, PyVarObject
28592906

Doc/api/api.tex

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ \section{Object Protocol}
10731073
Print an object \var{o}, on file \var{fp}. Returns \code{-1} on error
10741074
The flags argument is used to enable certain printing
10751075
options. The only option currently supported is
1076-
\constant{Py_Print_RAW}.
1076+
\constant{Py_PRINT_RAW}.
10771077
\end{cfuncdesc}
10781078
10791079
\begin{cfuncdesc}{int}{PyObject_HasAttrString}{PyObject *o, char *attr_name}
@@ -1721,28 +1721,40 @@ \subsection{String Objects}
17211721
\end{cvardesc}
17221722
17231723
\begin{cfuncdesc}{int}{PyString_Check}{PyObject *o}
1724-
1724+
Returns true if the object \var{o} is a string object.
17251725
\end{cfuncdesc}
17261726
17271727
\begin{cfuncdesc}{PyObject*}{PyString_FromStringAndSize}{const char *v,
17281728
int len}
1729+
Returns a new string object with the value \var{v} and length
1730+
\var{len} on success, and \NULL{} on failure. If \var{v} is \NULL{},
1731+
the contents of the string are uninitialized.
17291732
\end{cfuncdesc}
17301733
17311734
\begin{cfuncdesc}{PyObject*}{PyString_FromString}{const char *v}
1735+
Returns a new string object with the value \var{v} on success, and
1736+
\NULL{} on failure.
17321737
\end{cfuncdesc}
17331738
17341739
\begin{cfuncdesc}{int}{PyString_Size}{PyObject *string}
1740+
Returns the length of the string in string object \var{string}.
17351741
\end{cfuncdesc}
17361742
17371743
\begin{cfuncdesc}{char*}{PyString_AsString}{PyObject *string}
1744+
Resturns a \NULL{} terminated representation of the contents of \var{string}.
17381745
\end{cfuncdesc}
17391746
17401747
\begin{cfuncdesc}{void}{PyString_Concat}{PyObject **string,
17411748
PyObject *newpart}
1749+
Creates a new string object in \var{*string} containing the contents
1750+
of \var{newpart} appended to \var{string}.
17421751
\end{cfuncdesc}
17431752
17441753
\begin{cfuncdesc}{void}{PyString_ConcatAndDel}{PyObject **string,
17451754
PyObject *newpart}
1755+
Creates a new string object in \var{*string} containing the contents
1756+
of \var{newpart} appended to \var{string}. --WHAT IS THE
1757+
DIFFERENCE BETWEEN THIS AND PLAIN CONCAT?--
17461758
\end{cfuncdesc}
17471759
17481760
\begin{cfuncdesc}{int}{_PyString_Resize}{PyObject **string, int newsize}
@@ -1852,27 +1864,42 @@ \subsection{List Objects}
18521864
\end{cfuncdesc}
18531865
18541866
\begin{cfuncdesc}{PyObject*}{PyList_New}{int size}
1867+
Returns a new list of length \var{len} on success, and \NULL{} on
1868+
failure.
18551869
\end{cfuncdesc}
18561870
18571871
\begin{cfuncdesc}{int}{PyList_Size}{PyObject *list}
1872+
Returns the length of the list object in \var{list}.
18581873
\end{cfuncdesc}
18591874
18601875
\begin{cfuncdesc}{PyObject*}{PyList_GetItem}{PyObject *list, int index}
1876+
Returns the item in \var{list} at index \var{index}.
18611877
\end{cfuncdesc}
18621878
18631879
\begin{cfuncdesc}{int}{PyList_SetItem}{PyObject *list, int index,
18641880
PyObject *item}
1881+
Sets the item at index \var{index} in list to \var{item}.
18651882
\end{cfuncdesc}
18661883
18671884
\begin{cfuncdesc}{int}{PyList_Insert}{PyObject *list, int index,
18681885
PyObject *index}
1886+
Inserts the item \var{item} into list \var{list} in front of index \var{index}
1887+
and returns true if successful.
1888+
For example:
1889+
\begin{verbatim}
1890+
PyList_Insert(list, 0, object);
1891+
\end{verbatim}
18691892
\end{cfuncdesc}
1893+
would insert \var{object} at the front of the list.
18701894
18711895
\begin{cfuncdesc}{int}{PyList_Append}{PyObject *list, PyObject *item}
1896+
Appends the object \var{item} at the end of list \var{list}.
18721897
\end{cfuncdesc}
18731898
18741899
\begin{cfuncdesc}{PyObject*}{PyList_GetSlice}{PyObject *list,
18751900
int low, int high}
1901+
Returns a list of the objects in \var{list} containing the objects
1902+
\emph{between} \var{low} and \var{high}. Analogous to \var{list[low:high]}.
18761903
\end{cfuncdesc}
18771904
18781905
\begin{cfuncdesc}{int}{PyList_SetSlice}{PyObject *list,
@@ -1881,12 +1908,14 @@ \subsection{List Objects}
18811908
\end{cfuncdesc}
18821909
18831910
\begin{cfuncdesc}{int}{PyList_Sort}{PyObject *list}
1911+
18841912
\end{cfuncdesc}
18851913
18861914
\begin{cfuncdesc}{int}{PyList_Reverse}{PyObject *list}
18871915
\end{cfuncdesc}
18881916
18891917
\begin{cfuncdesc}{PyObject*}{PyList_AsTuple}{PyObject *list}
1918+
Returns a new tuple object containing the contents of \var{list}.
18901919
\end{cfuncdesc}
18911920
18921921
\begin{cfuncdesc}{PyObject*}{PyList_GET_ITEM}{PyObject *list, int i}
@@ -2051,21 +2080,29 @@ \subsection{Long Integer Objects}
20512080
\end{cfuncdesc}
20522081
20532082
\begin{cfuncdesc}{PyObject*}{PyLong_FromLong}{long v}
2083+
Returns a new \code{PyLong} object from \var{v}.
20542084
\end{cfuncdesc}
20552085
20562086
\begin{cfuncdesc}{PyObject*}{PyLong_FromUnsignedLong}{unsigned long v}
2087+
Returns a new \code{PyLong} object from an unsigned \C{} long.
20572088
\end{cfuncdesc}
20582089
20592090
\begin{cfuncdesc}{PyObject*}{PyLong_FromDouble}{double v}
2091+
Returns a new \code{PyLong} object from the integer part of \var{v}.
20602092
\end{cfuncdesc}
20612093
20622094
\begin{cfuncdesc}{long}{PyLong_AsLong}{PyObject *pylong}
2095+
Returns a \C{} \code{long} representation of the contents of \var{pylong}.
2096+
WHAT HAPPENS IF \var{pylong} > MAXLONG?
20632097
\end{cfuncdesc}
20642098
20652099
\begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLong}{PyObject *pylong}
2100+
Returns a \C{} \code{unsigned long} representation of the contents of
2101+
\var{pylong}. WHAT HAPPENS IF \var{pylong} > MAXLONG?
20662102
\end{cfuncdesc}
20672103
20682104
\begin{cfuncdesc}{double}{PyLong_AsDouble}{PyObject *pylong}
2105+
Returns a \C{} \code{double} representation of teh contents of \var{pylong}.
20692106
\end{cfuncdesc}
20702107
20712108
\begin{cfuncdesc}{PyObject*}{PyLong_FromString}{char *str, char **pend,
@@ -2091,9 +2128,11 @@ \subsection{Floating Point Objects}
20912128
\end{cfuncdesc}
20922129
20932130
\begin{cfuncdesc}{PyObject*}{PyFloat_FromDouble}{double v}
2131+
Creates a \code{PyFloat} object from \var{v}.
20942132
\end{cfuncdesc}
20952133
20962134
\begin{cfuncdesc}{double}{PyFloat_AsDouble}{PyObject *pyfloat}
2135+
Returns a \C{} \code{double} representation of the contents of \var{pyfloat}.
20972136
\end{cfuncdesc}
20982137
20992138
\begin{cfuncdesc}{double}{PyFloat_AS_DOUBLE}{PyObject *pyfloat}
@@ -2153,12 +2192,15 @@ \subsection{Complex Number Objects}
21532192
\end{cfuncdesc}
21542193
21552194
\begin{cfuncdesc}{PyObject*}{PyComplex_FromDoubles}{double real, double imag}
2195+
Returns a new \code{PyComplex} object from \var{real} and \var{imag}.
21562196
\end{cfuncdesc}
21572197
21582198
\begin{cfuncdesc}{double}{PyComplex_RealAsDouble}{PyObject *op}
2199+
Returns the real part of \var{op} as a \C{} \code{double}.
21592200
\end{cfuncdesc}
21602201
21612202
\begin{cfuncdesc}{double}{PyComplex_ImagAsDouble}{PyObject *op}
2203+
Returns the imaginary part of \var{op} as a \C{} \code{double}.
21622204
\end{cfuncdesc}
21632205
21642206
\begin{cfuncdesc}{Py_complex}{PyComplex_AsCComplex}{PyObject *op}
@@ -2854,6 +2896,11 @@ \chapter{Defining New Object Types}
28542896
\begin{cfuncdesc}{TYPE}{_PyObject_NEW_VAR}{TYPE, PyTypeObject *, int size}
28552897
\end{cfuncdesc}
28562898
2899+
Py_InitModule (!!!)
2900+
2901+
PyArg_ParseTupleAndKeywords, PyArg_ParseTuple, PyArg_Parse
2902+
2903+
Py_BuildValue
28572904
28582905
PyObject, PyVarObject
28592906

0 commit comments

Comments
 (0)