Karsten Hopp 6d6458
To: vim_dev@googlegroups.com
Karsten Hopp 6d6458
Subject: Patch 7.3.584
Karsten Hopp 6d6458
Fcc: outbox
Karsten Hopp 6d6458
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6d6458
Mime-Version: 1.0
Karsten Hopp 6d6458
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 6d6458
Content-Transfer-Encoding: 8bit
Karsten Hopp 6d6458
------------
Karsten Hopp 6d6458
Karsten Hopp 6d6458
Patch 7.3.584
Karsten Hopp 6d6458
Problem:    PyCObject is not always defined.
Karsten Hopp 6d6458
Solution:   Use PyObject instead.
Karsten Hopp 6d6458
Files:	    src/if_py_both.h, src/if_python.c
Karsten Hopp 6d6458
Karsten Hopp 6d6458
Karsten Hopp 6d6458
*** ../vim-7.3.583/src/if_py_both.h	2012-06-29 17:51:58.000000000 +0200
Karsten Hopp 6d6458
--- src/if_py_both.h	2012-06-30 13:25:24.000000000 +0200
Karsten Hopp 6d6458
***************
Karsten Hopp 6d6458
*** 2432,2463 ****
Karsten Hopp 6d6458
  convert_dl(PyObject *obj, typval_T *tv,
Karsten Hopp 6d6458
  				    pytotvfunc py_to_tv, PyObject *lookupDict)
Karsten Hopp 6d6458
  {
Karsten Hopp 6d6458
- # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
      PyObject	*capsule;
Karsten Hopp 6d6458
- # else
Karsten Hopp 6d6458
-     PyCObject	*cobject;
Karsten Hopp 6d6458
- # endif
Karsten Hopp 6d6458
      char	hexBuf[sizeof(void *) * 2 + 3];
Karsten Hopp 6d6458
  
Karsten Hopp 6d6458
      sprintf(hexBuf, "%p", obj);
Karsten Hopp 6d6458
  
Karsten Hopp 6d6458
  # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
      capsule = PyDict_GetItemString(lookupDict, hexBuf);
Karsten Hopp 6d6458
-     if (capsule == NULL)
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
!     cobject = (PyCObject *)PyDict_GetItemString(lookupDict, hexBuf);
Karsten Hopp 6d6458
!     if (cobject == NULL)
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
      {
Karsten Hopp 6d6458
  # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
  	capsule = PyCapsule_New(tv, NULL, NULL);
Karsten Hopp 6d6458
- 	PyDict_SetItemString(lookupDict, hexBuf, capsule);
Karsten Hopp 6d6458
- 	Py_DECREF(capsule);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
! 	cobject = PyCObject_FromVoidPtr(tv, NULL);
Karsten Hopp 6d6458
! 	PyDict_SetItemString(lookupDict, hexBuf, cobject);
Karsten Hopp 6d6458
! 	Py_DECREF(cobject);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
  	if (py_to_tv(obj, tv, lookupDict) == -1)
Karsten Hopp 6d6458
  	{
Karsten Hopp 6d6458
  	    tv->v_type = VAR_UNKNOWN;
Karsten Hopp 6d6458
--- 2432,2456 ----
Karsten Hopp 6d6458
  convert_dl(PyObject *obj, typval_T *tv,
Karsten Hopp 6d6458
  				    pytotvfunc py_to_tv, PyObject *lookupDict)
Karsten Hopp 6d6458
  {
Karsten Hopp 6d6458
      PyObject	*capsule;
Karsten Hopp 6d6458
      char	hexBuf[sizeof(void *) * 2 + 3];
Karsten Hopp 6d6458
  
Karsten Hopp 6d6458
      sprintf(hexBuf, "%p", obj);
Karsten Hopp 6d6458
  
Karsten Hopp 6d6458
  # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
      capsule = PyDict_GetItemString(lookupDict, hexBuf);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
!     capsule = (PyObject *)PyDict_GetItemString(lookupDict, hexBuf);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
+     if (capsule == NULL)
Karsten Hopp 6d6458
      {
Karsten Hopp 6d6458
  # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
  	capsule = PyCapsule_New(tv, NULL, NULL);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
! 	capsule = PyCObject_FromVoidPtr(tv, NULL);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
+ 	PyDict_SetItemString(lookupDict, hexBuf, capsule);
Karsten Hopp 6d6458
+ 	Py_DECREF(capsule);
Karsten Hopp 6d6458
  	if (py_to_tv(obj, tv, lookupDict) == -1)
Karsten Hopp 6d6458
  	{
Karsten Hopp 6d6458
  	    tv->v_type = VAR_UNKNOWN;
Karsten Hopp 6d6458
***************
Karsten Hopp 6d6458
*** 2478,2484 ****
Karsten Hopp 6d6458
  # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
  	v = PyCapsule_GetPointer(capsule, NULL);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
! 	v = PyCObject_AsVoidPtr(cobject);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
  	copy_tv(v, tv);
Karsten Hopp 6d6458
      }
Karsten Hopp 6d6458
--- 2471,2477 ----
Karsten Hopp 6d6458
  # ifdef PY_USE_CAPSULE
Karsten Hopp 6d6458
  	v = PyCapsule_GetPointer(capsule, NULL);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
! 	v = PyCObject_AsVoidPtr(capsule);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
  	copy_tv(v, tv);
Karsten Hopp 6d6458
      }
Karsten Hopp 6d6458
*** ../vim-7.3.583/src/if_python.c	2012-06-30 13:21:03.000000000 +0200
Karsten Hopp 6d6458
--- src/if_python.c	2012-06-30 13:23:22.000000000 +0200
Karsten Hopp 6d6458
***************
Karsten Hopp 6d6458
*** 327,334 ****
Karsten Hopp 6d6458
  static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
Karsten Hopp 6d6458
  static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
! static PyCObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void *));
Karsten Hopp 6d6458
! static void* (*dll_PyCObject_AsVoidPtr)(PyCObject *);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
  
Karsten Hopp 6d6458
  static HINSTANCE hinstPython = 0; /* Instance of python.dll */
Karsten Hopp 6d6458
--- 327,334 ----
Karsten Hopp 6d6458
  static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
Karsten Hopp 6d6458
  static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
Karsten Hopp 6d6458
  # else
Karsten Hopp 6d6458
! static PyObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void *));
Karsten Hopp 6d6458
! static void* (*dll_PyCObject_AsVoidPtr)(PyObject *);
Karsten Hopp 6d6458
  # endif
Karsten Hopp 6d6458
  
Karsten Hopp 6d6458
  static HINSTANCE hinstPython = 0; /* Instance of python.dll */
Karsten Hopp 6d6458
*** ../vim-7.3.583/src/version.c	2012-06-30 13:21:03.000000000 +0200
Karsten Hopp 6d6458
--- src/version.c	2012-06-30 13:33:08.000000000 +0200
Karsten Hopp 6d6458
***************
Karsten Hopp 6d6458
*** 716,717 ****
Karsten Hopp 6d6458
--- 716,719 ----
Karsten Hopp 6d6458
  {   /* Add new patch number below this line */
Karsten Hopp 6d6458
+ /**/
Karsten Hopp 6d6458
+     584,
Karsten Hopp 6d6458
  /**/
Karsten Hopp 6d6458
Karsten Hopp 6d6458
-- 
Karsten Hopp 6d6458
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 6d6458
91. It's Saturday afternoon in the middle of May and you
Karsten Hopp 6d6458
    are on computer.
Karsten Hopp 6d6458
Karsten Hopp 6d6458
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6d6458
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6d6458
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 6d6458
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///