bpo-36020: Remove snprintf macro in pyerrors.h by vstinner · Pull Request #20889 · python/cpython
Which snprintf implementations are broken?
This PR is about removing "snprintf" and "vsnprintf" macros from Python.h.
I consider proposing a follow-up macro to deprecate PyOS_ functions and use directly snprintf() and vsnprintf() functions. But I didn't have time to dig into the history and try to understand the rationale behind these wrappers. So for now, it's safer to use PyOS_ wrappers.
Currently, PyOS_vsnprintf() has a fallback implementation with this:
else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) {
_Py_FatalErrorFunc(__func__, "Buffer overflow");
}
Maybe this code is now dead since all platforms that we support are providing vsnprintf(). My plan is first to try to remove the fallback and see if it breaks any buildbot :-)