Skip to content

Use vsnprintf() on all platforms in PyOS_vsnprintf() #162054

Description

@deronnax

Feature or enhancement

Proposal:

PyOS_vsnprintf() in Python/mysnprintf.c still calls the non-standard _vsnprintf() when built with MSVC. Supported Windows builds use Visual Studio 2015+ and the UCRT, whose vsnprintf() conforms to C99, so it should always call vsnprintf(), as described in #101703 (comment).

This also makes the return value on truncation consistent across platforms, as documented for PyOS_vsnprintf().

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

#101703 (comment)

Linked PRs

Activity

  1. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-refactorCode refactoring (with no changes in behavior)
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-refactorCode refactoring (with no changes in behavior)
    on Nov 15, 2026
  2. added a commit that references this issue on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions