diff src/if_python.c @ 4823:46077370bc60 v7.3.1158

updated for version 7.3.1158 Problem: Crash when running test 86. (Jun Takimoto) Solution: Define PY_SSIZE_T_CLEAN early. (Elimar Riesebieter)
author Bram Moolenaar <bram@vim.org>
date Mon, 10 Jun 2013 18:36:24 +0200
parents 542af01979be
children b8eabb6a9687
line wrap: on
line diff
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -53,7 +53,14 @@
 # undef _XOPEN_SOURCE	/* pyconfig.h defines it as well. */
 #endif
 
+#define PY_SSIZE_T_CLEAN
+
 #include <Python.h>
+
+#if !defined(PY_VERSION_HEX) || PY_VERSION_HEX < 0x02050000
+# undef PY_SSIZE_T_CLEAN
+#endif
+
 #if defined(MACOS) && !defined(MACOS_X_UNIX)
 # include "macglue.h"
 # include <CodeFragments.h>
@@ -61,10 +68,6 @@
 #undef main /* Defined in python.h - aargh */
 #undef HAVE_FCNTL_H /* Clash with os_win32.h */
 
-#if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000
-# define PY_SSIZE_T_CLEAN
-#endif
-
 #define PyBytes_FromString PyString_FromString
 #define PyBytes_Check PyString_Check