summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/unicode.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-05-06 21:11:54 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-05-06 21:11:54 (GMT)
commit8cecc8c2624f31e1af4d24a14d1dde36a771fac9 (patch)
treedc10b27ac7eb8723dc35360fee78c33afe7eb3c1 /Doc/c-api/unicode.rst
parent9b5d4d8cef6c465292f02105b5e408eb5f7db01d (diff)
downloadcpython-8cecc8c2624f31e1af4d24a14d1dde36a771fac9.zip
cpython-8cecc8c2624f31e1af4d24a14d1dde36a771fac9.tar.gz
cpython-8cecc8c2624f31e1af4d24a14d1dde36a771fac9.tar.bz2
Issue #7330: Implement width and precision (ex: "%5.3s") for the format string
of PyUnicode_FromFormat() function, original patch written by Ysj Ray.
Diffstat (limited to 'Doc/c-api/unicode.rst')
-rw-r--r--Doc/c-api/unicode.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index abf353f..2f03f69 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -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)