diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-09-07 16:00:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-07 16:00:58 (GMT) |
commit | 886483e2b9bbabf60ab769683269b873381dd5ee (patch) | |
tree | 90fffe79f3a8897003eccd4c7e6c765ebe3e1bce /Doc/c-api | |
parent | 254a4663d8c5970ae2928185c50ebaa6c7e62c80 (diff) | |
download | cpython-886483e2b9bbabf60ab769683269b873381dd5ee.zip cpython-886483e2b9bbabf60ab769683269b873381dd5ee.tar.gz cpython-886483e2b9bbabf60ab769683269b873381dd5ee.tar.bz2 |
bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)
* Add %T format to PyUnicode_FromFormatV(), and so to
PyUnicode_FromFormat() and PyErr_Format(), to format an object type
name: equivalent to "%s" with Py_TYPE(obj)->tp_name.
* Replace Py_TYPE(obj)->tp_name with %T format in unicodeobject.c.
* Add unit test on %T format.
* Rename unicode_fromformat_write_cstr() to
unicode_fromformat_write_utf8(), to make the intent more explicit.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/unicode.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 92e22b1..66b1efc 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -519,6 +519,9 @@ APIs: | :attr:`%R` | PyObject\* | The result of calling | | | | :c:func:`PyObject_Repr`. | +-------------------+---------------------+--------------------------------+ + | :attr:`%T` | PyObject\* | Object type name, equivalent | + | | | to ``Py_TYPE(op)->tp_name``. | + +-------------------+---------------------+--------------------------------+ 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. @@ -543,6 +546,9 @@ APIs: Support width and precision formatter for ``"%s"``, ``"%A"``, ``"%U"``, ``"%V"``, ``"%S"``, ``"%R"`` added. + .. versionchanged:: 3.7 + Support for ``"%T"`` (object type name) added. + .. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs) |