diff options
author | Louie Lu <me@louie.lu> | 2017-04-27 03:36:35 (GMT) |
---|---|---|
committer | Xiang Zhang <angwerzx@126.com> | 2017-04-27 03:36:35 (GMT) |
commit | 88c38b32b761cb566759b8ad96704bff590a1de9 (patch) | |
tree | 6b077e8a1ff9cd95312b26b6d3c065683c5753bd | |
parent | a90b990480f45b6a0ad02d43455cf8b620bac9c5 (diff) | |
download | cpython-88c38b32b761cb566759b8ad96704bff590a1de9.zip cpython-88c38b32b761cb566759b8ad96704bff590a1de9.tar.gz cpython-88c38b32b761cb566759b8ad96704bff590a1de9.tar.bz2 |
bpo-28415: Note 0 conversion different between Python and C (#885)
-rw-r--r-- | Doc/c-api/bytes.rst | 35 | ||||
-rw-r--r-- | Doc/c-api/unicode.rst | 55 |
2 files changed, 48 insertions, 42 deletions
diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst index f89cfa2..5b9ebf6 100644 --- a/Doc/c-api/bytes.rst +++ b/Doc/c-api/bytes.rst @@ -72,29 +72,29 @@ called with a non-bytes parameter. | :attr:`%c` | int | A single byte, | | | | represented as a C int. | +-------------------+---------------+--------------------------------+ - | :attr:`%d` | int | Exactly equivalent to | - | | | ``printf("%d")``. | + | :attr:`%d` | int | Equivalent to | + | | | ``printf("%d")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%u` | unsigned int | Exactly equivalent to | - | | | ``printf("%u")``. | + | :attr:`%u` | unsigned int | Equivalent to | + | | | ``printf("%u")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%ld` | long | Exactly equivalent to | - | | | ``printf("%ld")``. | + | :attr:`%ld` | long | Equivalent to | + | | | ``printf("%ld")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%lu` | unsigned long | Exactly equivalent to | - | | | ``printf("%lu")``. | + | :attr:`%lu` | unsigned long | Equivalent to | + | | | ``printf("%lu")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%zd` | Py_ssize_t | Exactly equivalent to | - | | | ``printf("%zd")``. | + | :attr:`%zd` | Py_ssize_t | Equivalent to | + | | | ``printf("%zd")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%zu` | size_t | Exactly equivalent to | - | | | ``printf("%zu")``. | + | :attr:`%zu` | size_t | Equivalent to | + | | | ``printf("%zu")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%i` | int | Exactly equivalent to | - | | | ``printf("%i")``. | + | :attr:`%i` | int | Equivalent to | + | | | ``printf("%i")``. [1]_ | +-------------------+---------------+--------------------------------+ - | :attr:`%x` | int | Exactly equivalent to | - | | | ``printf("%x")``. | + | :attr:`%x` | int | Equivalent to | + | | | ``printf("%x")``. [1]_ | +-------------------+---------------+--------------------------------+ | :attr:`%s` | const char\* | A null-terminated C character | | | | array. | @@ -111,6 +111,9 @@ called with a non-bytes parameter. An unrecognized format character causes all the rest of the format string to be copied as-is to the result object, and any extra arguments discarded. + .. [1] For integer specifiers (d, u, ld, lu, zd, zu, i, x): the 0-conversion + flag has effect even when a precision is given. + .. c:function:: PyObject* PyBytes_FromFormatV(const char *format, va_list vargs) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index c743e57..84059e4 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -451,44 +451,44 @@ APIs: | :attr:`%c` | int | A single character, | | | | represented as a C int. | +-------------------+---------------------+--------------------------------+ - | :attr:`%d` | int | Exactly equivalent to | - | | | ``printf("%d")``. | + | :attr:`%d` | int | Equivalent to | + | | | ``printf("%d")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%u` | unsigned int | Exactly equivalent to | - | | | ``printf("%u")``. | + | :attr:`%u` | unsigned int | Equivalent to | + | | | ``printf("%u")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%ld` | long | Exactly equivalent to | - | | | ``printf("%ld")``. | + | :attr:`%ld` | long | Equivalent to | + | | | ``printf("%ld")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%li` | long | Exactly equivalent to | - | | | ``printf("%li")``. | + | :attr:`%li` | long | Equivalent to | + | | | ``printf("%li")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%lu` | unsigned long | Exactly equivalent to | - | | | ``printf("%lu")``. | + | :attr:`%lu` | unsigned long | Equivalent to | + | | | ``printf("%lu")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%lld` | long long | Exactly equivalent to | - | | | ``printf("%lld")``. | + | :attr:`%lld` | long long | Equivalent to | + | | | ``printf("%lld")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%lli` | long long | Exactly equivalent to | - | | | ``printf("%lli")``. | + | :attr:`%lli` | long long | Equivalent to | + | | | ``printf("%lli")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%llu` | unsigned long long | Exactly equivalent to | - | | | ``printf("%llu")``. | + | :attr:`%llu` | unsigned long long | Equivalent to | + | | | ``printf("%llu")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%zd` | Py_ssize_t | Exactly equivalent to | - | | | ``printf("%zd")``. | + | :attr:`%zd` | Py_ssize_t | Equivalent to | + | | | ``printf("%zd")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%zi` | Py_ssize_t | Exactly equivalent to | - | | | ``printf("%zi")``. | + | :attr:`%zi` | Py_ssize_t | Equivalent to | + | | | ``printf("%zi")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%zu` | size_t | Exactly equivalent to | - | | | ``printf("%zu")``. | + | :attr:`%zu` | size_t | Equivalent to | + | | | ``printf("%zu")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%i` | int | Exactly equivalent to | - | | | ``printf("%i")``. | + | :attr:`%i` | int | Equivalent to | + | | | ``printf("%i")``. [1]_ | +-------------------+---------------------+--------------------------------+ - | :attr:`%x` | int | Exactly equivalent to | - | | | ``printf("%x")``. | + | :attr:`%x` | int | Equivalent to | + | | | ``printf("%x")``. [1]_ | +-------------------+---------------------+--------------------------------+ | :attr:`%s` | const char\* | A null-terminated C character | | | | array. | @@ -530,6 +530,9 @@ APIs: characters for ``"%A"``, ``"%U"``, ``"%S"``, ``"%R"`` and ``"%V"`` (if the ``PyObject*`` argument is not NULL). + .. [1] For integer specifiers (d, u, ld, li, lu, lld, lli, llu, zd, zi, + zu, i, x): the 0-conversion flag has effect even when a precision is given. + .. versionchanged:: 3.2 Support for ``"%lld"`` and ``"%llu"`` added. |