diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-15 22:54:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 22:54:44 (GMT) |
commit | 7ab92d54b5d4440d84f6c02b4bc5a70103eff915 (patch) | |
tree | c21f01c5fc74889ba3143dee26cb88b3da025f2f /Doc/c-api/conversion.rst | |
parent | e822e37946f27c09953bb5733acf3b07c2db690f (diff) | |
download | cpython-7ab92d54b5d4440d84f6c02b4bc5a70103eff915.zip cpython-7ab92d54b5d4440d84f6c02b4bc5a70103eff915.tar.gz cpython-7ab92d54b5d4440d84f6c02b4bc5a70103eff915.tar.bz2 |
bpo-36020: Require vsnprintf() to build Python (GH-20899)
The C99 functions snprintf() and vsnprintf() are now required
to build Python.
PyOS_snprintf() and PyOS_vsnprintf() no longer call Py_FatalError().
Previously, they called Py_FatalError() on a buffer overflow on platforms
which don't provide vsnprintf().
Diffstat (limited to 'Doc/c-api/conversion.rst')
-rw-r--r-- | Doc/c-api/conversion.rst | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Doc/c-api/conversion.rst b/Doc/c-api/conversion.rst index b310fcb..efbaa52 100644 --- a/Doc/c-api/conversion.rst +++ b/Doc/c-api/conversion.rst @@ -27,12 +27,8 @@ not. The wrappers ensure that *str*[*size*-1] is always ``'\0'`` upon return. They never write more than *size* bytes (including the trailing ``'\0'``) into str. -Both functions require that ``str != NULL``, ``size > 0`` and ``format != -NULL``. - -If the platform doesn't have :c:func:`vsnprintf` and the buffer size needed to -avoid truncation exceeds *size* by more than 512 bytes, Python aborts with a -:c:func:`Py_FatalError`. +Both functions require that ``str != NULL``, ``size > 0``, ``format != NULL`` +and ``size < INT_MAX``. The return value (*rv*) for these functions should be interpreted as follows: @@ -48,8 +44,8 @@ The return value (*rv*) for these functions should be interpreted as follows: this case too, but the rest of *str* is undefined. The exact cause of the error depends on the underlying platform. -The following functions provide locale-independent string to number conversions. +The following functions provide locale-independent string to number conversions. .. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) |