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

Skip to content

Commit 1d1e1db

Browse files
committed
Corrected return type and value information for PyUnicode_Count() and
PyUnicode_Find(). This closes SF bug #566631.
1 parent ba3ff1b commit 1d1e1db

2 files changed

Lines changed: 20 additions & 16 deletions

File tree

Doc/api/concrete.tex

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,23 +1325,27 @@ \subsubsection{Methods and Slot Functions \label{unicodeMethodsAndSlots}}
13251325
match, \var{direction} == 1 a suffix match), 0 otherwise.
13261326
\end{cfuncdesc}
13271327

1328-
\begin{cfuncdesc}{PyObject*}{PyUnicode_Find}{PyObject *str,
1329-
PyObject *substr,
1330-
int start,
1331-
int end,
1332-
int direction}
1328+
\begin{cfuncdesc}{int}{PyUnicode_Find}{PyObject *str,
1329+
PyObject *substr,
1330+
int start,
1331+
int end,
1332+
int direction}
13331333
Return the first position of \var{substr} in
13341334
\var{str}[\var{start}:\var{end}] using the given \var{direction}
13351335
(\var{direction} == 1 means to do a forward search,
1336-
\var{direction} == -1 a backward search), 0 otherwise.
1337-
\end{cfuncdesc}
1338-
1339-
\begin{cfuncdesc}{PyObject*}{PyUnicode_Count}{PyObject *str,
1340-
PyObject *substr,
1341-
int start,
1342-
int end}
1343-
Count the number of occurrences of \var{substr} in
1344-
\var{str}[\var{start}:\var{end}]
1336+
\var{direction} == -1 a backward search). The return value is the
1337+
index of the first match; a value of \code{-1} indicates that no
1338+
match was found, and \code{-2} indicates that an error occurred and
1339+
an exception has been set.
1340+
\end{cfuncdesc}
1341+
1342+
\begin{cfuncdesc}{int}{PyUnicode_Count}{PyObject *str,
1343+
PyObject *substr,
1344+
int start,
1345+
int end}
1346+
Return the number of non-overlapping occurrences of \var{substr} in
1347+
\code{\var{str}[\var{start}:\var{end}]}. Returns \code{-1} if an
1348+
error occurred.
13451349
\end{cfuncdesc}
13461350

13471351
\begin{cfuncdesc}{PyObject*}{PyUnicode_Replace}{PyObject *str,

Doc/api/refcounts.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,14 +1393,14 @@ PyUnicode_Tailmatch:int:start::
13931393
PyUnicode_Tailmatch:int:end::
13941394
PyUnicode_Tailmatch:int:direction::
13951395

1396-
PyUnicode_Find:PyObject*::+1:
1396+
PyUnicode_Find:int:::
13971397
PyUnicode_Find:PyObject*:str:0:
13981398
PyUnicode_Find:PyObject*:substr:0:
13991399
PyUnicode_Find:int:start::
14001400
PyUnicode_Find:int:end::
14011401
PyUnicode_Find:int:direction::
14021402

1403-
PyUnicode_Count:PyObject*::+1:
1403+
PyUnicode_Count:int:::
14041404
PyUnicode_Count:PyObject*:str:0:
14051405
PyUnicode_Count:PyObject*:substr:0:
14061406
PyUnicode_Count:int:start::

0 commit comments

Comments
 (0)