diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-15 19:59:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 19:59:47 (GMT) |
commit | e822e37946f27c09953bb5733acf3b07c2db690f (patch) | |
tree | d0bb8d8769be9f469aa6675fb820bc41acfd65c5 /Modules | |
parent | 5f79f46612c351bde78a41c5264c42db21008868 (diff) | |
download | cpython-e822e37946f27c09953bb5733acf3b07c2db690f.zip cpython-e822e37946f27c09953bb5733acf3b07c2db690f.tar.gz cpython-e822e37946f27c09953bb5733acf3b07c2db690f.tar.bz2 |
bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)
On Windows, #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().
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/callbacks.c | 2 | ||||
-rw-r--r-- | Modules/socketmodule.c | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 29e8fac..2abfa67 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -84,7 +84,7 @@ PrintError(const char *msg, ...) va_list marker; va_start(marker, msg); - vsnprintf(buf, sizeof(buf), msg, marker); + PyOS_vsnprintf(buf, sizeof(buf), msg, marker); va_end(marker); if (f != NULL && f != Py_None) PyFile_WriteString(buf, f); diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index f60a27e..db0eeaa 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -436,13 +436,12 @@ remove_unusable_flags(PyObject *m) #endif #ifdef MS_WIN32 -#undef EAFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define snprintf _snprintf +# undef EAFNOSUPPORT +# define EAFNOSUPPORT WSAEAFNOSUPPORT #endif #ifndef SOCKETCLOSE -#define SOCKETCLOSE close +# define SOCKETCLOSE close #endif #if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) && !defined(__NetBSD__) && !defined(__DragonFly__) |