summaryrefslogtreecommitdiffstats
path: root/src/if_python.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-10 18:36:24 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-10 18:36:24 +0200
commit0bdda37fb4b8118ec4bd797eddca9eaf5d3b381d (patch)
tree9037d905c68c34ad25a203757d62c20cee526b47 /src/if_python.c
parentbcf4d178abef9336709b53516fbf0164ce5ebe09 (diff)
updated for version 7.3.1158v7.3.1158
Problem: Crash when running test 86. (Jun Takimoto) Solution: Define PY_SSIZE_T_CLEAN early. (Elimar Riesebieter)
Diffstat (limited to 'src/if_python.c')
-rw-r--r--src/if_python.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/if_python.c b/src/if_python.c
index 254f01a75b..318b170ee2 100644
--- 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