Skip to content

Commit a66e029

Browse files
committed
Make doc for PyErr_Format() up to date.
1 parent 34520cd commit a66e029

1 file changed

Lines changed: 5 additions & 74 deletions

File tree

‎Doc/c-api/exceptions.rst‎

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -145,79 +145,10 @@ in various ways. There is a separate error indicator for each thread.
145145
146146
.. c:function:: PyObject* PyErr_Format(PyObject *exception, const char *format, ...)
147147
148-
This function sets the error indicator and returns *NULL*. *exception* should be
149-
a Python exception (class, not an instance). *format* should be an ASCII-encoded string,
150-
containing format codes, similar to :c:func:`printf`. The ``width.precision``
151-
before a format code is parsed, but the width part is ignored.
152-
153-
.. % This should be exactly the same as the table in PyString_FromFormat.
154-
.. % One should just refer to the other.
155-
.. % The descriptions for %zd and %zu are wrong, but the truth is complicated
156-
.. % because not all compilers support the %z width modifier -- we fake it
157-
.. % when necessary via interpolating PY_FORMAT_SIZE_T.
158-
.. % Similar comments apply to the %ll width modifier and
159-
.. % PY_FORMAT_LONG_LONG.
160-
161-
+-------------------+---------------+--------------------------------+
162-
| Format Characters | Type | Comment |
163-
+===================+===============+================================+
164-
| :attr:`%%` | *n/a* | The literal % character. |
165-
+-------------------+---------------+--------------------------------+
166-
| :attr:`%c` | int | A single character, |
167-
| | | represented as an C int. |
168-
+-------------------+---------------+--------------------------------+
169-
| :attr:`%d` | int | Exactly equivalent to |
170-
| | | ``printf("%d")``. |
171-
+-------------------+---------------+--------------------------------+
172-
| :attr:`%u` | unsigned int | Exactly equivalent to |
173-
| | | ``printf("%u")``. |
174-
+-------------------+---------------+--------------------------------+
175-
| :attr:`%ld` | long | Exactly equivalent to |
176-
| | | ``printf("%ld")``. |
177-
+-------------------+---------------+--------------------------------+
178-
| :attr:`%lu` | unsigned long | Exactly equivalent to |
179-
| | | ``printf("%lu")``. |
180-
+-------------------+---------------+--------------------------------+
181-
| :attr:`%lld` | long long | Exactly equivalent to |
182-
| | | ``printf("%lld")``. |
183-
+-------------------+---------------+--------------------------------+
184-
| :attr:`%llu` | unsigned | Exactly equivalent to |
185-
| | long long | ``printf("%llu")``. |
186-
+-------------------+---------------+--------------------------------+
187-
| :attr:`%zd` | Py_ssize_t | Exactly equivalent to |
188-
| | | ``printf("%zd")``. |
189-
+-------------------+---------------+--------------------------------+
190-
| :attr:`%zu` | size_t | Exactly equivalent to |
191-
| | | ``printf("%zu")``. |
192-
+-------------------+---------------+--------------------------------+
193-
| :attr:`%i` | int | Exactly equivalent to |
194-
| | | ``printf("%i")``. |
195-
+-------------------+---------------+--------------------------------+
196-
| :attr:`%x` | int | Exactly equivalent to |
197-
| | | ``printf("%x")``. |
198-
+-------------------+---------------+--------------------------------+
199-
| :attr:`%s` | char\* | A null-terminated C character |
200-
| | | array. |
201-
+-------------------+---------------+--------------------------------+
202-
| :attr:`%p` | void\* | The hex representation of a C |
203-
| | | pointer. Mostly equivalent to |
204-
| | | ``printf("%p")`` except that |
205-
| | | it is guaranteed to start with |
206-
| | | the literal ``0x`` regardless |
207-
| | | of what the platform's |
208-
| | | ``printf`` yields. |
209-
+-------------------+---------------+--------------------------------+
210-
211-
An unrecognized format character causes all the rest of the format string to be
212-
copied as-is to the result string, and any extra arguments discarded.
213-
214-
.. note::
215-
216-
The `"%lld"` and `"%llu"` format specifiers are only available
217-
when :const:`HAVE_LONG_LONG` is defined.
218-
219-
.. versionchanged:: 3.2
220-
Support for `"%lld"` and `"%llu"` added.
148+
This function sets the error indicator and returns *NULL*. *exception*
149+
should be a Python exception class. The *format* and subsequent
150+
parameters help format the error message; they have the same meaning and
151+
values as in :c:func:`PyUnicode_FromFormat`.
221152
222153
223154
.. c:function:: void PyErr_SetNone(PyObject *type)
@@ -369,7 +300,7 @@ in various ways. There is a separate error indicator for each thread.
369300
.. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...)
370301
371302
Function similar to :c:func:`PyErr_WarnEx`, but use
372-
:c:func:`PyUnicode_FromFormatV` to format the warning message.
303+
:c:func:`PyUnicode_FromFormat` to format the warning message.
373304
374305
.. versionadded:: 3.2
375306

0 commit comments

Comments
 (0)