aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-15 13:20:10 -0700
committerGitHub <noreply@github.com>2020-06-15 13:20:10 -0700
commitb498c7f1b3890e43ea2e7d1570f8403707ea4cc6 (patch)
tree25c15e5106769850ee4037aa00805671cb95a322 /Modules
parentbpo-40448: ensurepip: Do not use cache (GH-19812) (diff)
downloadcpython-b498c7f1b3890e43ea2e7d1570f8403707ea4cc6.tar.gz
cpython-b498c7f1b3890e43ea2e7d1570f8403707ea4cc6.tar.bz2
cpython-b498c7f1b3890e43ea2e7d1570f8403707ea4cc6.zip
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 'Modules')
-rw-r--r--Modules/_ctypes/callbacks.c2
-rw-r--r--Modules/socketmodule.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 29e8fac8c94..2abfa67cdc0 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 580ac0af5af..76ef606e10b 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -473,13 +473,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__)