mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Issue #7330: Implement width and precision (ex: "%5.3s") for the format string
of PyUnicode_FromFormat() function, original patch written by Ysj Ray.
This commit is contained in:
parent
9b5d4d8cef
commit
8cecc8c262
4 changed files with 294 additions and 96 deletions
|
@ -526,12 +526,23 @@ APIs:
|
|||
The `"%lld"` and `"%llu"` format specifiers are only available
|
||||
when :const:`HAVE_LONG_LONG` is defined.
|
||||
|
||||
.. note::
|
||||
The width formatter unit is number of characters rather than bytes.
|
||||
The precision formatter unit is number of bytes for ``"%s"`` and
|
||||
``"%V"`` (if the ``PyObject*`` argument is NULL), and a number of
|
||||
characters for ``"%A"``, ``"%U"``, ``"%S"``, ``"%R"`` and ``"%V"``
|
||||
(if the ``PyObject*`` argument is not NULL).
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
Support for ``"%lld"`` and ``"%llu"`` added.
|
||||
|
||||
.. versionchanged:: 3.3
|
||||
Support for ``"%li"``, ``"%lli"`` and ``"%zi"`` added.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
Support width and precision formatter for ``"%s"``, ``"%A"``, ``"%U"``,
|
||||
``"%V"``, ``"%S"``, ``"%R"`` added.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue