Karsten Hopp cc2199
To: vim_dev@googlegroups.com
Karsten Hopp cc2199
Subject: Patch 7.3.1040
Karsten Hopp cc2199
Fcc: outbox
Karsten Hopp cc2199
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp cc2199
Mime-Version: 1.0
Karsten Hopp cc2199
Content-Type: text/plain; charset=UTF-8
Karsten Hopp cc2199
Content-Transfer-Encoding: 8bit
Karsten Hopp cc2199
------------
Karsten Hopp cc2199
Karsten Hopp cc2199
Patch 7.3.1040
Karsten Hopp cc2199
Problem:    Python: Problems with debugging dynamic build.
Karsten Hopp cc2199
Solution:   Python patch 1. (ZyX)
Karsten Hopp cc2199
Files:      src/if_python.c, src/if_python3.c
Karsten Hopp cc2199
Karsten Hopp cc2199
Karsten Hopp cc2199
*** ../vim-7.3.1039/src/if_python.c	2013-05-21 22:23:51.000000000 +0200
Karsten Hopp cc2199
--- src/if_python.c	2013-05-29 21:32:46.000000000 +0200
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 21,26 ****
Karsten Hopp cc2199
--- 21,35 ----
Karsten Hopp cc2199
  
Karsten Hopp cc2199
  #include <limits.h>
Karsten Hopp cc2199
  
Karsten Hopp cc2199
+ /* uncomment this if used with the debug version of python.
Karsten Hopp cc2199
+  * Checked on 2.7.4. */
Karsten Hopp cc2199
+ /* #define Py_DEBUG */
Karsten Hopp cc2199
+ /* Note: most of time you can add -DPy_DEBUG to CFLAGS in place of uncommenting 
Karsten Hopp cc2199
+  */
Karsten Hopp cc2199
+ /* uncomment this if used with the debug version of python, but without its 
Karsten Hopp cc2199
+  * allocator */
Karsten Hopp cc2199
+ /* #define Py_DEBUG_NO_PYMALLOC */
Karsten Hopp cc2199
+ 
Karsten Hopp cc2199
  /* Python.h defines _POSIX_THREADS itself (if needed) */
Karsten Hopp cc2199
  #ifdef _POSIX_THREADS
Karsten Hopp cc2199
  # undef _POSIX_THREADS
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 240,247 ****
Karsten Hopp cc2199
  #  define PyType_IsSubtype dll_PyType_IsSubtype
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
Karsten Hopp cc2199
! #  define PyObject_Malloc dll_PyObject_Malloc
Karsten Hopp cc2199
! #  define PyObject_Free dll_PyObject_Free
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # ifdef PY_USE_CAPSULE
Karsten Hopp cc2199
  #  define PyCapsule_New dll_PyCapsule_New
Karsten Hopp cc2199
--- 249,266 ----
Karsten Hopp cc2199
  #  define PyType_IsSubtype dll_PyType_IsSubtype
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
Karsten Hopp cc2199
! #  ifdef Py_DEBUG
Karsten Hopp cc2199
! #   define _Py_NegativeRefcount dll__Py_NegativeRefcount
Karsten Hopp cc2199
! #   define _Py_RefTotal (*dll__Py_RefTotal)
Karsten Hopp cc2199
! #   define _Py_Dealloc dll__Py_Dealloc
Karsten Hopp cc2199
! #  endif
Karsten Hopp cc2199
! #  if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
! #   define _PyObject_DebugMalloc dll__PyObject_DebugMalloc
Karsten Hopp cc2199
! #   define _PyObject_DebugFree dll__PyObject_DebugFree
Karsten Hopp cc2199
! #  else
Karsten Hopp cc2199
! #   define PyObject_Malloc dll_PyObject_Malloc
Karsten Hopp cc2199
! #   define PyObject_Free dll_PyObject_Free
Karsten Hopp cc2199
! #  endif
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # ifdef PY_USE_CAPSULE
Karsten Hopp cc2199
  #  define PyCapsule_New dll_PyCapsule_New
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 350,357 ****
Karsten Hopp cc2199
--- 369,386 ----
Karsten Hopp cc2199
  static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
Karsten Hopp cc2199
+ #  ifdef Py_DEBUG
Karsten Hopp cc2199
+ static void (*dll__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
Karsten Hopp cc2199
+ static Py_ssize_t* dll__Py_RefTotal;
Karsten Hopp cc2199
+ static void (*dll__Py_Dealloc)(PyObject *obj);
Karsten Hopp cc2199
+ #  endif
Karsten Hopp cc2199
+ #  if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
+ static void (*dll__PyObject_DebugFree)(void*);
Karsten Hopp cc2199
+ static void* (*dll__PyObject_DebugMalloc)(size_t);
Karsten Hopp cc2199
+ #  else
Karsten Hopp cc2199
  static void* (*dll_PyObject_Malloc)(size_t);
Karsten Hopp cc2199
  static void (*dll_PyObject_Free)(void*);
Karsten Hopp cc2199
+ #  endif
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # ifdef PY_USE_CAPSULE
Karsten Hopp cc2199
  static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 469,480 ****
Karsten Hopp cc2199
      {"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
Karsten Hopp cc2199
      {"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
Karsten Hopp cc2199
      {"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
Karsten Hopp cc2199
- # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \
Karsten Hopp cc2199
- 	&& SIZEOF_SIZE_T != SIZEOF_INT
Karsten Hopp cc2199
-     {"Py_InitModule4_64", (PYTHON_PROC*)&dll_Py_InitModule4},
Karsten Hopp cc2199
- # else
Karsten Hopp cc2199
-     {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
Karsten Hopp cc2199
- # endif
Karsten Hopp cc2199
      {"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome},
Karsten Hopp cc2199
      {"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
Karsten Hopp cc2199
      {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
Karsten Hopp cc2199
--- 498,503 ----
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 496,503 ****
Karsten Hopp cc2199
--- 519,550 ----
Karsten Hopp cc2199
      {"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
Karsten Hopp cc2199
+ #  ifdef Py_DEBUG
Karsten Hopp cc2199
+     {"_Py_NegativeRefcount", (PYTHON_PROC*)&dll__Py_NegativeRefcount},
Karsten Hopp cc2199
+     {"_Py_RefTotal", (PYTHON_PROC*)&dll__Py_RefTotal},
Karsten Hopp cc2199
+     {"_Py_Dealloc", (PYTHON_PROC*)&dll__Py_Dealloc},
Karsten Hopp cc2199
+ #  endif
Karsten Hopp cc2199
+ #  if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
+     {"_PyObject_DebugFree", (PYTHON_PROC*)&dll__PyObject_DebugFree},
Karsten Hopp cc2199
+     {"_PyObject_DebugMalloc", (PYTHON_PROC*)&dll__PyObject_DebugMalloc},
Karsten Hopp cc2199
+ #  else
Karsten Hopp cc2199
      {"PyObject_Malloc", (PYTHON_PROC*)&dll_PyObject_Malloc},
Karsten Hopp cc2199
      {"PyObject_Free", (PYTHON_PROC*)&dll_PyObject_Free},
Karsten Hopp cc2199
+ #  endif
Karsten Hopp cc2199
+ # endif
Karsten Hopp cc2199
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \
Karsten Hopp cc2199
+ 	&& SIZEOF_SIZE_T != SIZEOF_INT
Karsten Hopp cc2199
+ #  ifdef Py_DEBUG
Karsten Hopp cc2199
+     {"Py_InitModule4TraceRefs_64", (PYTHON_PROC*)&dll_Py_InitModule4},
Karsten Hopp cc2199
+ #  else
Karsten Hopp cc2199
+     {"Py_InitModule4_64", (PYTHON_PROC*)&dll_Py_InitModule4},
Karsten Hopp cc2199
+ #  endif
Karsten Hopp cc2199
+ # else
Karsten Hopp cc2199
+ #  ifdef Py_DEBUG
Karsten Hopp cc2199
+     {"Py_InitModule4TraceRefs", (PYTHON_PROC*)&dll_Py_InitModule4},
Karsten Hopp cc2199
+ #  else
Karsten Hopp cc2199
+     {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
Karsten Hopp cc2199
+ #  endif
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  # ifdef PY_USE_CAPSULE
Karsten Hopp cc2199
      {"PyCapsule_New", (PYTHON_PROC*)&dll_PyCapsule_New},
Karsten Hopp cc2199
*** ../vim-7.3.1039/src/if_python3.c	2013-05-21 22:23:51.000000000 +0200
Karsten Hopp cc2199
--- src/if_python3.c	2013-05-29 21:32:46.000000000 +0200
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 24,29 ****
Karsten Hopp cc2199
--- 24,34 ----
Karsten Hopp cc2199
  
Karsten Hopp cc2199
  /* uncomment this if used with the debug version of python */
Karsten Hopp cc2199
  /* #define Py_DEBUG */
Karsten Hopp cc2199
+ /* Note: most of time you can add -DPy_DEBUG to CFLAGS in place of uncommenting 
Karsten Hopp cc2199
+  */
Karsten Hopp cc2199
+ /* uncomment this if used with the debug version of python, but without its 
Karsten Hopp cc2199
+  * allocator */
Karsten Hopp cc2199
+ /* #define Py_DEBUG_NO_PYMALLOC */
Karsten Hopp cc2199
  
Karsten Hopp cc2199
  #include "vim.h"
Karsten Hopp cc2199
  
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 207,212 ****
Karsten Hopp cc2199
--- 212,222 ----
Karsten Hopp cc2199
  #  define _Py_NegativeRefcount py3__Py_NegativeRefcount
Karsten Hopp cc2199
  #  define _Py_RefTotal (*py3__Py_RefTotal)
Karsten Hopp cc2199
  #  define _Py_Dealloc py3__Py_Dealloc
Karsten Hopp cc2199
+ #  define PyModule_Create2TraceRefs py3_PyModule_Create2TraceRefs
Karsten Hopp cc2199
+ # else
Karsten Hopp cc2199
+ #  define PyModule_Create2 py3_PyModule_Create2
Karsten Hopp cc2199
+ # endif
Karsten Hopp cc2199
+ # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
  #  define _PyObject_DebugMalloc py3__PyObject_DebugMalloc
Karsten Hopp cc2199
  #  define _PyObject_DebugFree py3__PyObject_DebugFree
Karsten Hopp cc2199
  # else
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 218,224 ****
Karsten Hopp cc2199
  # define PyObject_GC_UnTrack py3_PyObject_GC_UnTrack
Karsten Hopp cc2199
  # define PyType_GenericAlloc py3_PyType_GenericAlloc
Karsten Hopp cc2199
  # define PyType_GenericNew py3_PyType_GenericNew
Karsten Hopp cc2199
- # define PyModule_Create2 py3_PyModule_Create2
Karsten Hopp cc2199
  # undef PyUnicode_FromString
Karsten Hopp cc2199
  # define PyUnicode_FromString py3_PyUnicode_FromString
Karsten Hopp cc2199
  # undef PyUnicode_Decode
Karsten Hopp cc2199
--- 228,233 ----
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 227,233 ****
Karsten Hopp cc2199
  # define PyCapsule_New py3_PyCapsule_New
Karsten Hopp cc2199
  # define PyCapsule_GetPointer py3_PyCapsule_GetPointer
Karsten Hopp cc2199
  
Karsten Hopp cc2199
! # ifdef Py_DEBUG
Karsten Hopp cc2199
  #  undef PyObject_NEW
Karsten Hopp cc2199
  #  define PyObject_NEW(type, typeobj) \
Karsten Hopp cc2199
  ( (type *) PyObject_Init( \
Karsten Hopp cc2199
--- 236,242 ----
Karsten Hopp cc2199
  # define PyCapsule_New py3_PyCapsule_New
Karsten Hopp cc2199
  # define PyCapsule_GetPointer py3_PyCapsule_GetPointer
Karsten Hopp cc2199
  
Karsten Hopp cc2199
! # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
  #  undef PyObject_NEW
Karsten Hopp cc2199
  #  define PyObject_NEW(type, typeobj) \
Karsten Hopp cc2199
  ( (type *) PyObject_Init( \
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 317,323 ****
Karsten Hopp cc2199
  static PyObject* (*py3_PyFloat_FromDouble)(double num);
Karsten Hopp cc2199
  static double (*py3_PyFloat_AsDouble)(PyObject *);
Karsten Hopp cc2199
  static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name);
Karsten Hopp cc2199
- static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
Karsten Hopp cc2199
  static PyObject* (*py3_PyType_GenericAlloc)(PyTypeObject *type, Py_ssize_t nitems);
Karsten Hopp cc2199
  static PyObject* (*py3_PyType_GenericNew)(PyTypeObject *type, PyObject *args, PyObject *kwds);
Karsten Hopp cc2199
  static PyTypeObject* py3_PyType_Type;
Karsten Hopp cc2199
--- 326,331 ----
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 328,341 ****
Karsten Hopp cc2199
  static PyObject* (*py3_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
Karsten Hopp cc2199
  static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
Karsten Hopp cc2199
  # ifdef Py_DEBUG
Karsten Hopp cc2199
!     static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
Karsten Hopp cc2199
!     static Py_ssize_t* py3__Py_RefTotal;
Karsten Hopp cc2199
!     static void (*py3__Py_Dealloc)(PyObject *obj);
Karsten Hopp cc2199
!     static void (*py3__PyObject_DebugFree)(void*);
Karsten Hopp cc2199
!     static void* (*py3__PyObject_DebugMalloc)(size_t);
Karsten Hopp cc2199
  # else
Karsten Hopp cc2199
!     static void (*py3_PyObject_Free)(void*);
Karsten Hopp cc2199
!     static void* (*py3_PyObject_Malloc)(size_t);
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  static PyObject*(*py3__PyObject_GC_New)(PyTypeObject *);
Karsten Hopp cc2199
  static void(*py3_PyObject_GC_Del)(void *);
Karsten Hopp cc2199
--- 336,354 ----
Karsten Hopp cc2199
  static PyObject* (*py3_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
Karsten Hopp cc2199
  static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
Karsten Hopp cc2199
  # ifdef Py_DEBUG
Karsten Hopp cc2199
! static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
Karsten Hopp cc2199
! static Py_ssize_t* py3__Py_RefTotal;
Karsten Hopp cc2199
! static void (*py3__Py_Dealloc)(PyObject *obj);
Karsten Hopp cc2199
! static PyObject* (*py3_PyModule_Create2TraceRefs)(struct PyModuleDef* module, int module_api_version);
Karsten Hopp cc2199
! # else
Karsten Hopp cc2199
! static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
Karsten Hopp cc2199
! # endif
Karsten Hopp cc2199
! # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
! static void (*py3__PyObject_DebugFree)(void*);
Karsten Hopp cc2199
! static void* (*py3__PyObject_DebugMalloc)(size_t);
Karsten Hopp cc2199
  # else
Karsten Hopp cc2199
! static void (*py3_PyObject_Free)(void*);
Karsten Hopp cc2199
! static void* (*py3_PyObject_Malloc)(size_t);
Karsten Hopp cc2199
  # endif
Karsten Hopp cc2199
  static PyObject*(*py3__PyObject_GC_New)(PyTypeObject *);
Karsten Hopp cc2199
  static void(*py3_PyObject_GC_Del)(void *);
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 451,457 ****
Karsten Hopp cc2199
      {"PyFloat_FromDouble", (PYTHON_PROC*)&py3_PyFloat_FromDouble},
Karsten Hopp cc2199
      {"PyFloat_AsDouble", (PYTHON_PROC*)&py3_PyFloat_AsDouble},
Karsten Hopp cc2199
      {"PyObject_GenericGetAttr", (PYTHON_PROC*)&py3_PyObject_GenericGetAttr},
Karsten Hopp cc2199
-     {"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
Karsten Hopp cc2199
      {"PyType_GenericAlloc", (PYTHON_PROC*)&py3_PyType_GenericAlloc},
Karsten Hopp cc2199
      {"PyType_GenericNew", (PYTHON_PROC*)&py3_PyType_GenericNew},
Karsten Hopp cc2199
      {"PyType_Type", (PYTHON_PROC*)&py3_PyType_Type},
Karsten Hopp cc2199
--- 464,469 ----
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 463,468 ****
Karsten Hopp cc2199
--- 475,485 ----
Karsten Hopp cc2199
      {"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount},
Karsten Hopp cc2199
      {"_Py_RefTotal", (PYTHON_PROC*)&py3__Py_RefTotal},
Karsten Hopp cc2199
      {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc},
Karsten Hopp cc2199
+     {"PyModule_Create2TraceRefs", (PYTHON_PROC*)&py3_PyModule_Create2TraceRefs},
Karsten Hopp cc2199
+ # else
Karsten Hopp cc2199
+     {"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
Karsten Hopp cc2199
+ # endif
Karsten Hopp cc2199
+ # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
      {"_PyObject_DebugFree", (PYTHON_PROC*)&py3__PyObject_DebugFree},
Karsten Hopp cc2199
      {"_PyObject_DebugMalloc", (PYTHON_PROC*)&py3__PyObject_DebugMalloc},
Karsten Hopp cc2199
  # else
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 656,662 ****
Karsten Hopp cc2199
      static void
Karsten Hopp cc2199
  call_PyObject_Free(void *p)
Karsten Hopp cc2199
  {
Karsten Hopp cc2199
! #ifdef Py_DEBUG
Karsten Hopp cc2199
      _PyObject_DebugFree(p);
Karsten Hopp cc2199
  #else
Karsten Hopp cc2199
      PyObject_Free(p);
Karsten Hopp cc2199
--- 673,679 ----
Karsten Hopp cc2199
      static void
Karsten Hopp cc2199
  call_PyObject_Free(void *p)
Karsten Hopp cc2199
  {
Karsten Hopp cc2199
! #if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
Karsten Hopp cc2199
      _PyObject_DebugFree(p);
Karsten Hopp cc2199
  #else
Karsten Hopp cc2199
      PyObject_Free(p);
Karsten Hopp cc2199
*** ../vim-7.3.1039/src/version.c	2013-05-29 21:14:37.000000000 +0200
Karsten Hopp cc2199
--- src/version.c	2013-05-29 21:32:32.000000000 +0200
Karsten Hopp cc2199
***************
Karsten Hopp cc2199
*** 730,731 ****
Karsten Hopp cc2199
--- 730,733 ----
Karsten Hopp cc2199
  {   /* Add new patch number below this line */
Karsten Hopp cc2199
+ /**/
Karsten Hopp cc2199
+     1040,
Karsten Hopp cc2199
  /**/
Karsten Hopp cc2199
Karsten Hopp cc2199
-- 
Karsten Hopp cc2199
hundred-and-one symptoms of being an internet addict:
Karsten Hopp cc2199
17. You turn on your intercom when leaving the room so you can hear if new
Karsten Hopp cc2199
    e-mail arrives.
Karsten Hopp cc2199
Karsten Hopp cc2199
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp cc2199
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp cc2199
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp cc2199
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///