diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-06-15 20:20:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 20:20:10 (GMT) |
commit | b498c7f1b3890e43ea2e7d1570f8403707ea4cc6 (patch) | |
tree | 25c15e5106769850ee4037aa00805671cb95a322 /Include/pyerrors.h | |
parent | 9a0624a3d9feb0c7664ace7a894a04e4af547661 (diff) | |
download | cpython-b498c7f1b3890e43ea2e7d1570f8403707ea4cc6.zip cpython-b498c7f1b3890e43ea2e7d1570f8403707ea4cc6.tar.gz cpython-b498c7f1b3890e43ea2e7d1570f8403707ea4cc6.tar.bz2 |
bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)
On Windows, GH-include "pyerrors.h" no longer defines "snprintf" and
"vsnprintf" macros.
PyOS_snprintf() and PyOS_vsnprintf() should be used to get portable
behavior.
Replace snprintf() calls with PyOS_snprintf() and replace vsnprintf()
calls with PyOS_vsnprintf().
(cherry picked from commit e822e37946f27c09953bb5733acf3b07c2db690f)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Include/pyerrors.h')
-rw-r--r-- | Include/pyerrors.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 399bb7c..979a26b 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -4,6 +4,8 @@ extern "C" { #endif +#include <stdarg.h> // va_list + /* Error handling definitions */ PyAPI_FUNC(void) PyErr_SetNone(PyObject *); @@ -307,21 +309,6 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( const char *reason /* UTF-8 encoded string */ ); -/* These APIs aren't really part of the error implementation, but - often needed to format error messages; the native C lib APIs are - not available on all platforms, which is why we provide emulations - for those platforms in Python/mysnprintf.c, - WARNING: The return value of snprintf varies across platforms; do - not rely on any particular behavior; eventually the C99 defn may - be reliable. -*/ -#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) -# define HAVE_SNPRINTF -# define snprintf _snprintf -# define vsnprintf _vsnprintf -#endif - -#include <stdarg.h> PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 3, 4))); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) |