GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add a warning message about PyOS_snprintf (#95993) · mpage/cpython@358e173

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Doc/c-api
    • conversion.rst
  • Python
    • mysnprintf.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Doc/c-api/conversion.rst‎

Copy file name to clipboardExpand all lines: Doc/c-api/conversion.rst
+2-1Lines changed: 2 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ not.
2828
The wrappers ensure that ``str[size-1]`` is always ``'\0'`` upon return. They
2929
never write more than *size* bytes (including the trailing ``'\0'``) into str.
3030
Both functions require that ``str != NULL``, ``size > 0``, ``format != NULL``
31-
and ``size < INT_MAX``.
31+
and ``size < INT_MAX``. Note that this means there is no equivalent to the C99
32+
``n = snprintf(NULL, 0, ...)`` which would determine the necessary buffer size.
3233
3334
The return value (*rv*) for these functions should be interpreted as follows:
3435
Collapse file

‎Python/mysnprintf.c‎

Copy file name to clipboardExpand all lines: Python/mysnprintf.c
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
would have been written had the buffer not been too small, and to set
1010
the last byte of the buffer to \0. At least MS _vsnprintf returns a
1111
negative value instead, and fills the entire buffer with non-\0 data.
12+
Unlike C99, our wrappers do not support passing a null buffer.
1213
1314
The wrappers ensure that str[size-1] is always \0 upon return.
1415

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.