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

Skip to content

Commit 57a5932

Browse files
author
Moshe Zadka
committed
Update documentation for PyErr_Format, because the function has changed.
Connected to patch 100895
1 parent 9bfd2bf commit 57a5932

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

Doc/api/api.tex

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -882,15 +882,25 @@ \chapter{Exception Handling \label{exceptionHandling}}
882882
\end{cfuncdesc}
883883

884884
\begin{cfuncdesc}{PyObject*}{PyErr_Format}{PyObject *exception,
885-
const char *format, ...}
886-
This function sets the error indicator using a printf-style format
887-
string. The first argument specifies the exception type and the
888-
second argument specifies the format string for the exception. Any
889-
subsequent arguments are converted to output by the C library's
890-
\cfunction{vsprintf()} function. The buffer used internally by
891-
\cfunction{PyErr_Format()} is 500 bytes long. The caller is
892-
responsible for guaranteeing that the formatted output does not
893-
overflow the buffer.
885+
const char *format, \moreargs}
886+
This function sets the error indicator.
887+
\var{exception} should be a Python object.
888+
\var{fmt} should be a string, containing format codes, similar to
889+
\cfunction{printf}. The \code{width.precision} before a format code
890+
is parsed, but the width part is ignored.
891+
892+
\begin{tableii}{c|l}{character}{Character}{Meaning}
893+
\lineii{c}{Character, as an \ctype{int} parameter}
894+
\lineii{d}{Number in decimal, as an \ctype{int} parameter}
895+
\lineii{x}{Number in hexadecimal, as an \ctype{int} parameter}
896+
\lineii{x}{A string, as a \ctype{char *} parameter}
897+
\end{tableii}
898+
899+
An unrecognized format character causes all the rest of
900+
the format string to be copied as-is to the result string,
901+
and any extra arguments discarded.
902+
903+
A new reference is returned, which is owned by the caller.
894904
\end{cfuncdesc}
895905

896906
\begin{cfuncdesc}{void}{PyErr_SetNone}{PyObject *type}

0 commit comments

Comments
 (0)