@@ -133,8 +133,9 @@ typedef int Py_ssize_clean_t;
133133
134134/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
135135 * format to convert an argument with the width of a size_t or Py_ssize_t.
136- * C99 introduced "z" for this purpose, but not all platforms support that;
137- * e.g., MS compilers use "I" instead.
136+ * C99 introduced "z" for this purpose, but old MSVCs had not supported it.
137+ * Since MSVC supports "z" since (at least) 2015, we can just use "z"
138+ * for new code.
138139 *
139140 * These "high level" Python format functions interpret "z" correctly on
140141 * all platforms (Python interprets the format string itself, and does whatever
@@ -152,19 +153,11 @@ typedef int Py_ssize_clean_t;
152153 * Py_ssize_t index;
153154 * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index);
154155 *
155- * That will expand to %ld, or %Id, or to something else correct for a
156- * Py_ssize_t on the platform.
156+ * That will expand to %zd or to something else correct for a Py_ssize_t on
157+ * the platform.
157158 */
158159#ifndef PY_FORMAT_SIZE_T
159- # if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__ )
160- # define PY_FORMAT_SIZE_T ""
161- # elif SIZEOF_SIZE_T == SIZEOF_LONG
162- # define PY_FORMAT_SIZE_T "l"
163- # elif defined(MS_WINDOWS )
164- # define PY_FORMAT_SIZE_T "I"
165- # else
166- # error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T"
167- # endif
160+ # define PY_FORMAT_SIZE_T "z"
168161#endif
169162
170163/* Py_LOCAL can be used instead of static to get the fastest possible calling
0 commit comments