Add a warning message about PyOS_snprintf (GH-95993)

(cherry picked from commit c7b2204996)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-10-07 13:26:46 -07:00 committed by GitHub
parent 107ba927cf
commit 0a84b7aa4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -28,7 +28,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``, ``format != NULL``
and ``size < INT_MAX``.
and ``size < INT_MAX``. Note that this means there is no equivalent to the C99
``n = snprintf(NULL, 0, ...)`` which would determine the necessary buffer size.
The return value (*rv*) for these functions should be interpreted as follows: