changeset 4591:1e8952a5a726 v7.3.1043

updated for version 7.3.1043 Problem: Python: Dynamic compilation with 2.3 fails. Solution: Python patch 4. (ZyX)
author Bram Moolenaar <bram@vim.org>
date Wed, 29 May 2013 22:05:55 +0200
parents 80261e8d907b
children 706bcc2010f5
files src/if_python.c src/version.c
diffstat 2 files changed, 36 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -194,6 +194,7 @@ struct PyMethodDef { Py_ssize_t a; };
 # define PyDict_New dll_PyDict_New
 # define PyDict_GetItemString dll_PyDict_GetItemString
 # define PyDict_Next dll_PyDict_Next
+# define PyDict_Type (*dll_PyDict_Type)
 # ifdef PyMapping_Items
 #  define PY_NO_MAPPING_ITEMS
 # else
@@ -234,8 +235,14 @@ struct PyMethodDef { Py_ssize_t a; };
 # define Py_IsInitialized dll_Py_IsInitialized
 # define _PyObject_New dll__PyObject_New
 # define _PyObject_GC_New dll__PyObject_GC_New
-# define PyObject_GC_Del dll_PyObject_GC_Del
-# define PyObject_GC_UnTrack dll_PyObject_GC_UnTrack
+# ifdef PyObject_GC_Del
+#  define Py_underscore_GC
+#  define _PyObject_GC_Del dll__PyObject_GC_Del
+#  define _PyObject_GC_UnTrack dll__PyObject_GC_UnTrack
+# else
+#  define PyObject_GC_Del dll_PyObject_GC_Del
+#  define PyObject_GC_UnTrack dll_PyObject_GC_UnTrack
+# endif
 # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
 #  define _PyObject_NextNotImplemented (*dll__PyObject_NextNotImplemented)
 # endif
@@ -247,13 +254,13 @@ struct PyMethodDef { Py_ssize_t a; };
 # define PyObject_IsTrue dll_PyObject_IsTrue
 # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
 #  define PyType_IsSubtype dll_PyType_IsSubtype
-# endif
-# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
 #  ifdef Py_DEBUG
 #   define _Py_NegativeRefcount dll__Py_NegativeRefcount
 #   define _Py_RefTotal (*dll__Py_RefTotal)
 #   define _Py_Dealloc dll__Py_Dealloc
 #  endif
+# endif
+# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
 #  if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
 #   define _PyObject_DebugMalloc dll__PyObject_DebugMalloc
 #   define _PyObject_DebugFree dll__PyObject_DebugFree
@@ -316,7 +323,8 @@ static PyTypeObject* dll_PyTuple_Type;
 static PyObject*(*dll_PyImport_ImportModule)(const char *);
 static PyObject*(*dll_PyDict_New)(void);
 static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
-static int (*dll_PyDict_Next)(PyObject *, Py_ssize_t *, PyObject **, PyObject **);
+static int (*dll_PyDict_Next)(PyObject *, PyInt *, PyObject **, PyObject **);
+static PyTypeObject* dll_PyDict_Type;
 # ifndef PY_NO_MAPPING_ITEMS
 static PyObject* (*dll_PyMapping_Items)(PyObject *);
 # endif
@@ -354,8 +362,13 @@ static void(*dll_Py_Finalize)(void);
 static int(*dll_Py_IsInitialized)(void);
 static PyObject*(*dll__PyObject_New)(PyTypeObject *, PyObject *);
 static PyObject*(*dll__PyObject_GC_New)(PyTypeObject *);
+# ifdef Py_underscore_GC
+static void(*dll__PyObject_GC_Del)(void *);
+static void(*dll__PyObject_GC_UnTrack)(void *);
+# else
 static void(*dll_PyObject_GC_Del)(void *);
 static void(*dll_PyObject_GC_UnTrack)(void *);
+# endif
 static PyObject*(*dll__PyObject_Init)(PyObject *, PyTypeObject *);
 static PyObject* (*dll_PyObject_GetIter)(PyObject *);
 static int (*dll_PyObject_IsTrue)(PyObject *);
@@ -367,13 +380,13 @@ static PyObject* _Py_ZeroStruct;
 static PyObject* dll__Py_TrueStruct;
 # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
 static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
-# endif
-# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
 #  ifdef Py_DEBUG
 static void (*dll__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
-static Py_ssize_t* dll__Py_RefTotal;
+static PyInt* dll__Py_RefTotal;
 static void (*dll__Py_Dealloc)(PyObject *obj);
 #  endif
+# endif
+# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
 #  if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
 static void (*dll__PyObject_DebugFree)(void*);
 static void* (*dll__PyObject_DebugMalloc)(size_t);
@@ -470,6 +483,7 @@ static struct
     {"PyDict_GetItemString", (PYTHON_PROC*)&dll_PyDict_GetItemString},
     {"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
     {"PyDict_New", (PYTHON_PROC*)&dll_PyDict_New},
+    {"PyDict_Type", (PYTHON_PROC*)&dll_PyDict_Type},
 # ifndef PY_NO_MAPPING_ITEMS
     {"PyMapping_Items", (PYTHON_PROC*)&dll_PyMapping_Items},
 # endif
@@ -504,8 +518,13 @@ static struct
     {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
     {"_PyObject_New", (PYTHON_PROC*)&dll__PyObject_New},
     {"_PyObject_GC_New", (PYTHON_PROC*)&dll__PyObject_GC_New},
+# ifdef Py_underscore_GC
+    {"_PyObject_GC_Del", (PYTHON_PROC*)&dll__PyObject_GC_Del},
+    {"_PyObject_GC_UnTrack", (PYTHON_PROC*)&dll__PyObject_GC_UnTrack},
+# else
     {"PyObject_GC_Del", (PYTHON_PROC*)&dll_PyObject_GC_Del},
     {"PyObject_GC_UnTrack", (PYTHON_PROC*)&dll_PyObject_GC_UnTrack},
+# endif
     {"PyObject_Init", (PYTHON_PROC*)&dll__PyObject_Init},
     {"PyObject_GetIter", (PYTHON_PROC*)&dll_PyObject_GetIter},
     {"PyObject_IsTrue", (PYTHON_PROC*)&dll_PyObject_IsTrue},
@@ -516,14 +535,14 @@ static struct
     {"_Py_ZeroStruct", (PYTHON_PROC*)&dll__Py_ZeroStruct},
     {"_Py_TrueStruct", (PYTHON_PROC*)&dll__Py_TrueStruct},
 # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
-    {"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
-# endif
-# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
 #  ifdef Py_DEBUG
     {"_Py_NegativeRefcount", (PYTHON_PROC*)&dll__Py_NegativeRefcount},
     {"_Py_RefTotal", (PYTHON_PROC*)&dll__Py_RefTotal},
     {"_Py_Dealloc", (PYTHON_PROC*)&dll__Py_Dealloc},
 #  endif
+    {"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
+# endif
+# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
 #  if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
     {"_PyObject_DebugFree", (PYTHON_PROC*)&dll__PyObject_DebugFree},
     {"_PyObject_DebugMalloc", (PYTHON_PROC*)&dll__PyObject_DebugMalloc},
@@ -696,8 +715,10 @@ static PyObject *FunctionGetattr(PyObjec
 #endif
 #ifndef Py_CLEAR
 # define Py_CLEAR(obj) \
-    Py_XDECREF(obj); \
-    obj = NULL;
+    { \
+	Py_XDECREF(obj); \
+	obj = NULL; \
+    }
 #endif
 
 /*
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1043,
+/**/
     1042,
 /**/
     1041,