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

Skip to content

Commit f66a1dd

Browse files
committed
Merged revisions 86838 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r86838 | antoine.pitrou | 2010-11-27 21:40:43 +0100 (sam., 27 nov. 2010) | 3 lines Make doc for PyErr_Format() up to date. ........
1 parent 115b99c commit f66a1dd

1 file changed

Lines changed: 4 additions & 57 deletions

File tree

Doc/c-api/exceptions.rst

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -145,63 +145,10 @@ in various ways. There is a separate error indicator for each thread.
145145

146146
.. cfunction:: 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 a string,
150-
containing format codes, similar to :cfunc:`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-
159-
+-------------------+---------------+--------------------------------+
160-
| Format Characters | Type | Comment |
161-
+===================+===============+================================+
162-
| :attr:`%%` | *n/a* | The literal % character. |
163-
+-------------------+---------------+--------------------------------+
164-
| :attr:`%c` | int | A single character, |
165-
| | | represented as an C int. |
166-
+-------------------+---------------+--------------------------------+
167-
| :attr:`%d` | int | Exactly equivalent to |
168-
| | | ``printf("%d")``. |
169-
+-------------------+---------------+--------------------------------+
170-
| :attr:`%u` | unsigned int | Exactly equivalent to |
171-
| | | ``printf("%u")``. |
172-
+-------------------+---------------+--------------------------------+
173-
| :attr:`%ld` | long | Exactly equivalent to |
174-
| | | ``printf("%ld")``. |
175-
+-------------------+---------------+--------------------------------+
176-
| :attr:`%lu` | unsigned long | Exactly equivalent to |
177-
| | | ``printf("%lu")``. |
178-
+-------------------+---------------+--------------------------------+
179-
| :attr:`%zd` | Py_ssize_t | Exactly equivalent to |
180-
| | | ``printf("%zd")``. |
181-
+-------------------+---------------+--------------------------------+
182-
| :attr:`%zu` | size_t | Exactly equivalent to |
183-
| | | ``printf("%zu")``. |
184-
+-------------------+---------------+--------------------------------+
185-
| :attr:`%i` | int | Exactly equivalent to |
186-
| | | ``printf("%i")``. |
187-
+-------------------+---------------+--------------------------------+
188-
| :attr:`%x` | int | Exactly equivalent to |
189-
| | | ``printf("%x")``. |
190-
+-------------------+---------------+--------------------------------+
191-
| :attr:`%s` | char\* | A null-terminated C character |
192-
| | | array. |
193-
+-------------------+---------------+--------------------------------+
194-
| :attr:`%p` | void\* | The hex representation of a C |
195-
| | | pointer. Mostly equivalent to |
196-
| | | ``printf("%p")`` except that |
197-
| | | it is guaranteed to start with |
198-
| | | the literal ``0x`` regardless |
199-
| | | of what the platform's |
200-
| | | ``printf`` yields. |
201-
+-------------------+---------------+--------------------------------+
202-
203-
An unrecognized format character causes all the rest of the format string to be
204-
copied as-is to the result string, and any extra arguments discarded.
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 :cfunc:`PyUnicode_FromFormat`.
205152

206153

207154
.. cfunction:: void PyErr_SetNone(PyObject *type)

0 commit comments

Comments
 (0)