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

Skip to content

Commit 1ff49a7

Browse files
author
Skip Montanaro
committed
* Add description of PyInt_FromString.
* Correct description of PyFloat_FromString. While ignored, the pend argument still has to be given. * Typo in PyLong_FromString.
1 parent 3ed7b03 commit 1ff49a7

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

Doc/api/concrete.tex

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,25 @@ \subsection{Plain Integer Objects \label{intObjects}}
129129
\versionadded{2.2}
130130
\end{cfuncdesc}
131131

132+
\begin{cfuncdesc}{PyObject*}{PyInt_FromString}{char *str, char **pend,
133+
int base}
134+
Return a new \ctype{PyIntObject} or \ctype{PyLongObject} based on the
135+
string value in \var{str}, which is interpreted according to the radix in
136+
\var{base}. If \var{pend} is non-\NULL, \code{*\var{pend}} will point to
137+
the first character in \var{str} which follows the representation of the
138+
number. If \var{base} is \code{0}, the radix will be determined based on
139+
the leading characters of \var{str}: if \var{str} starts with \code{'0x'}
140+
or \code{'0X'}, radix 16 will be used; if \var{str} starts with
141+
\code{'0'}, radix 8 will be used; otherwise radix 10 will be used. If
142+
\var{base} is not \code{0}, it must be between \code{2} and \code{36},
143+
inclusive. Leading spaces are ignored. If there are no digits,
144+
\exception{ValueError} will be raised. If the string represents a number
145+
too large to be contained within the machine's \ctype{long int} type and
146+
overflow warnings are being suppressed, a \ctype{PyLongObject} will be
147+
returned. If overflow warnings are not being suppressed, \NULL{} will be
148+
returned in this case.
149+
\end{cfuncdesc}
150+
132151
\begin{cfuncdesc}{PyObject*}{PyInt_FromLong}{long ival}
133152
Creates a new integer object with a value of \var{ival}.
134153

@@ -214,7 +233,7 @@ \subsection{Long Integer Objects \label{longObjects}}
214233
\var{base}. If \var{pend} is non-\NULL, \code{*\var{pend}} will
215234
point to the first character in \var{str} which follows the
216235
representation of the number. If \var{base} is \code{0}, the radix
217-
will be determined base on the leading characters of \var{str}: if
236+
will be determined based on the leading characters of \var{str}: if
218237
\var{str} starts with \code{'0x'} or \code{'0X'}, radix 16 will be
219238
used; if \var{str} starts with \code{'0'}, radix 8 will be used;
220239
otherwise radix 10 will be used. If \var{base} is not \code{0}, it
@@ -317,9 +336,10 @@ \subsection{Floating Point Objects \label{floatObjects}}
317336
\versionadded{2.2}
318337
\end{cfuncdesc}
319338

320-
\begin{cfuncdesc}{PyObject*}{PyFloat_FromString}{PyObject *str}
339+
\begin{cfuncdesc}{PyObject*}{PyFloat_FromString}{PyObject *str, char **pend}
321340
Creates a \ctype{PyFloatObject} object based on the string value in
322-
\var{str}, or \NULL{} on failure.
341+
\var{str}, or \NULL{} on failure. The \var{pend} argument is ignored. It
342+
remains only for backward compatibility.
323343
\end{cfuncdesc}
324344

325345
\begin{cfuncdesc}{PyObject*}{PyFloat_FromDouble}{double v}

0 commit comments

Comments
 (0)