mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-111696, PEP 737: Add %T and %N to PyUnicode_FromFormat() (#116839)
This commit is contained in:
parent
5f52d20a93
commit
7bbb9b57e6
7 changed files with 135 additions and 2 deletions
|
@ -518,6 +518,26 @@ APIs:
|
|||
- :c:expr:`PyObject*`
|
||||
- The result of calling :c:func:`PyObject_Repr`.
|
||||
|
||||
* - ``T``
|
||||
- :c:expr:`PyObject*`
|
||||
- Get the fully qualified name of an object type;
|
||||
call :c:func:`PyType_GetFullyQualifiedName`.
|
||||
|
||||
* - ``T#``
|
||||
- :c:expr:`PyObject*`
|
||||
- Similar to ``T`` format, but use a colon (``:``) as separator between
|
||||
the module name and the qualified name.
|
||||
|
||||
* - ``N``
|
||||
- :c:expr:`PyTypeObject*`
|
||||
- Get the fully qualified name of a type;
|
||||
call :c:func:`PyType_GetFullyQualifiedName`.
|
||||
|
||||
* - ``N#``
|
||||
- :c:expr:`PyTypeObject*`
|
||||
- Similar to ``N`` format, but use a colon (``:``) as separator between
|
||||
the module name and the qualified name.
|
||||
|
||||
.. note::
|
||||
The width formatter unit is number of characters rather than bytes.
|
||||
The precision formatter unit is number of bytes or :c:type:`wchar_t`
|
||||
|
@ -553,6 +573,9 @@ APIs:
|
|||
In previous versions it caused all the rest of the format string to be
|
||||
copied as-is to the result string, and any extra arguments discarded.
|
||||
|
||||
.. versionchanged:: 3.13
|
||||
Support for ``%T``, ``%T#``, ``%N`` and ``%N#`` formats added.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue