diff src/if_python.c @ 4511:ce94a870b59b v7.3.1003

updated for version 7.3.1003 Problem: Python interface does not compile with Python 2.2 Solution: Fix thread issues and True/False. (ZyX)
author Bram Moolenaar <bram@vim.org>
date Tue, 21 May 2013 22:23:56 +0200
parents 47e6dec5ce3c
children b9f87487d935
line wrap: on
line diff
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -641,7 +641,7 @@ static int initialised = 0;
 #define DICTKEY_UNREF
 #define DICTKEY_DECL
 
-#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self);
+#define DESTRUCTOR_FINISH(self) self->ob_type->tp_free((PyObject*)self);
 
 #define WIN_PYTHON_REF(win) win->w_python_ref
 #define BUF_PYTHON_REF(buf) buf->b_python_ref
@@ -656,6 +656,15 @@ static PyObject *DictionaryGetattr(PyObj
 static PyObject *ListGetattr(PyObject *, char *);
 static PyObject *FunctionGetattr(PyObject *, char *);
 
+#ifndef Py_VISIT
+# define Py_VISIT(obj) visit(obj, arg)
+#endif
+#ifndef Py_CLEAR
+# define Py_CLEAR(obj) \
+    Py_XDECREF(obj); \
+    obj = NULL;
+#endif
+
 /*
  * Include the code shared with if_python3.c
  */
@@ -881,7 +890,11 @@ DoPyCommand(const char *cmd, rangeinitia
     Python_RestoreThread();	    /* enter python */
 #endif
 
-    run((char *) cmd, arg, &pygilstate);
+    run((char *) cmd, arg
+#ifdef PY_CAN_RECURSE
+	    , &pygilstate
+#endif
+	    );
 
 #ifdef PY_CAN_RECURSE
     PyGILState_Release(pygilstate);