diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-27 21:01:19 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-27 21:01:19 (GMT) |
commit | f66a1dd12bc9ea4e05658b53d68e764fd6bebc4b (patch) | |
tree | 03d8dd8f342d13095bddd7707d4c99a20281c931 /Doc/c-api | |
parent | 115b99c22256cb7e106c41d2c0d6de73cc47318c (diff) | |
download | cpython-f66a1dd12bc9ea4e05658b53d68e764fd6bebc4b.zip cpython-f66a1dd12bc9ea4e05658b53d68e764fd6bebc4b.tar.gz cpython-f66a1dd12bc9ea4e05658b53d68e764fd6bebc4b.tar.bz2 |
Merged revisions 86838 via svnmerge from
svn+ssh://pythondev@svn.python.org/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.
........
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/exceptions.rst | 61 |
1 files changed, 4 insertions, 57 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 87891fb..f465c58 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -145,63 +145,10 @@ in various ways. There is a separate error indicator for each thread. .. cfunction:: PyObject* PyErr_Format(PyObject *exception, const char *format, ...) - This function sets the error indicator and returns *NULL*. *exception* should be - a Python exception (class, not an instance). *format* should be a string, - containing format codes, similar to :cfunc:`printf`. The ``width.precision`` - before a format code is parsed, but the width part is ignored. - - .. % This should be exactly the same as the table in PyString_FromFormat. - .. % One should just refer to the other. - .. % The descriptions for %zd and %zu are wrong, but the truth is complicated - .. % because not all compilers support the %z width modifier -- we fake it - .. % when necessary via interpolating PY_FORMAT_SIZE_T. - - +-------------------+---------------+--------------------------------+ - | Format Characters | Type | Comment | - +===================+===============+================================+ - | :attr:`%%` | *n/a* | The literal % character. | - +-------------------+---------------+--------------------------------+ - | :attr:`%c` | int | A single character, | - | | | represented as an C int. | - +-------------------+---------------+--------------------------------+ - | :attr:`%d` | int | Exactly equivalent to | - | | | ``printf("%d")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%u` | unsigned int | Exactly equivalent to | - | | | ``printf("%u")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%ld` | long | Exactly equivalent to | - | | | ``printf("%ld")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%lu` | unsigned long | Exactly equivalent to | - | | | ``printf("%lu")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%zd` | Py_ssize_t | Exactly equivalent to | - | | | ``printf("%zd")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%zu` | size_t | Exactly equivalent to | - | | | ``printf("%zu")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%i` | int | Exactly equivalent to | - | | | ``printf("%i")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%x` | int | Exactly equivalent to | - | | | ``printf("%x")``. | - +-------------------+---------------+--------------------------------+ - | :attr:`%s` | char\* | A null-terminated C character | - | | | array. | - +-------------------+---------------+--------------------------------+ - | :attr:`%p` | void\* | The hex representation of a C | - | | | pointer. Mostly equivalent to | - | | | ``printf("%p")`` except that | - | | | it is guaranteed to start with | - | | | the literal ``0x`` regardless | - | | | of what the platform's | - | | | ``printf`` yields. | - +-------------------+---------------+--------------------------------+ - - An unrecognized format character causes all the rest of the format string to be - copied as-is to the result string, and any extra arguments discarded. + This function sets the error indicator and returns *NULL*. *exception* + should be a Python exception class. The *format* and subsequent + parameters help format the error message; they have the same meaning and + values as in :cfunc:`PyUnicode_FromFormat`. .. cfunction:: void PyErr_SetNone(PyObject *type) |