Karsten Hopp 252336
To: vim_dev@googlegroups.com
Karsten Hopp 252336
Subject: Patch 7.3.1048
Karsten Hopp 252336
Fcc: outbox
Karsten Hopp 252336
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 252336
Mime-Version: 1.0
Karsten Hopp 252336
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 252336
Content-Transfer-Encoding: 8bit
Karsten Hopp 252336
------------
Karsten Hopp 252336
Karsten Hopp 252336
Patch 7.3.1048
Karsten Hopp 252336
Problem:    Python: no consistent naming.
Karsten Hopp 252336
Solution:   Python patch 9: Rename d to dict and lookupDict to lookup_dict.
Karsten Hopp 252336
	    (ZyX)
Karsten Hopp 252336
Files:	    src/if_py_both.h
Karsten Hopp 252336
Karsten Hopp 252336
Karsten Hopp 252336
*** ../vim-7.3.1047/src/if_py_both.h	2013-05-29 22:36:06.000000000 +0200
Karsten Hopp 252336
--- src/if_py_both.h	2013-05-29 22:39:16.000000000 +0200
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 475,481 ****
Karsten Hopp 252336
   * you call VimToPython.
Karsten Hopp 252336
   */
Karsten Hopp 252336
      static PyObject *
Karsten Hopp 252336
! VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      PyObject	*result;
Karsten Hopp 252336
      PyObject	*newObj;
Karsten Hopp 252336
--- 475,481 ----
Karsten Hopp 252336
   * you call VimToPython.
Karsten Hopp 252336
   */
Karsten Hopp 252336
      static PyObject *
Karsten Hopp 252336
! VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      PyObject	*result;
Karsten Hopp 252336
      PyObject	*newObj;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 489,495 ****
Karsten Hopp 252336
  	return result;
Karsten Hopp 252336
      }
Karsten Hopp 252336
  
Karsten Hopp 252336
!     /* Check if we run into a recursive loop.  The item must be in lookupDict
Karsten Hopp 252336
       * then and we can use it again. */
Karsten Hopp 252336
      if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
Karsten Hopp 252336
  	    || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
Karsten Hopp 252336
--- 489,495 ----
Karsten Hopp 252336
  	return result;
Karsten Hopp 252336
      }
Karsten Hopp 252336
  
Karsten Hopp 252336
!     /* Check if we run into a recursive loop.  The item must be in lookup_dict
Karsten Hopp 252336
       * then and we can use it again. */
Karsten Hopp 252336
      if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
Karsten Hopp 252336
  	    || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 498,504 ****
Karsten Hopp 252336
  		our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list
Karsten Hopp 252336
  					   : (void *)our_tv->vval.v_dict);
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if ((result = PyDict_GetItemString(lookupDict, ptrBuf)))
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    Py_INCREF(result);
Karsten Hopp 252336
  	    return result;
Karsten Hopp 252336
--- 498,504 ----
Karsten Hopp 252336
  		our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list
Karsten Hopp 252336
  					   : (void *)our_tv->vval.v_dict);
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if ((result = PyDict_GetItemString(lookup_dict, ptrBuf)))
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    Py_INCREF(result);
Karsten Hopp 252336
  	    return result;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 538,544 ****
Karsten Hopp 252336
  	if (!(result = PyList_New(0)))
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (PyDict_SetItemString(lookupDict, ptrBuf, result))
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    Py_DECREF(result);
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
--- 538,544 ----
Karsten Hopp 252336
  	if (!(result = PyList_New(0)))
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (PyDict_SetItemString(lookup_dict, ptrBuf, result))
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    Py_DECREF(result);
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 546,552 ****
Karsten Hopp 252336
  
Karsten Hopp 252336
  	for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
! 	    if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict)))
Karsten Hopp 252336
  	    {
Karsten Hopp 252336
  		Py_DECREF(result);
Karsten Hopp 252336
  		return NULL;
Karsten Hopp 252336
--- 546,552 ----
Karsten Hopp 252336
  
Karsten Hopp 252336
  	for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
! 	    if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookup_dict)))
Karsten Hopp 252336
  	    {
Karsten Hopp 252336
  		Py_DECREF(result);
Karsten Hopp 252336
  		return NULL;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 573,579 ****
Karsten Hopp 252336
  	if (!(result = PyDict_New()))
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (PyDict_SetItemString(lookupDict, ptrBuf, result))
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    Py_DECREF(result);
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
--- 573,579 ----
Karsten Hopp 252336
  	if (!(result = PyDict_New()))
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (PyDict_SetItemString(lookup_dict, ptrBuf, result))
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    Py_DECREF(result);
Karsten Hopp 252336
  	    return NULL;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 586,592 ****
Karsten Hopp 252336
  		--todo;
Karsten Hopp 252336
  
Karsten Hopp 252336
  		di = dict_lookup(hi);
Karsten Hopp 252336
! 		if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookupDict)))
Karsten Hopp 252336
  		{
Karsten Hopp 252336
  		    Py_DECREF(result);
Karsten Hopp 252336
  		    return NULL;
Karsten Hopp 252336
--- 586,592 ----
Karsten Hopp 252336
  		--todo;
Karsten Hopp 252336
  
Karsten Hopp 252336
  		di = dict_lookup(hi);
Karsten Hopp 252336
! 		if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookup_dict)))
Karsten Hopp 252336
  		{
Karsten Hopp 252336
  		    Py_DECREF(result);
Karsten Hopp 252336
  		    return NULL;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 970,980 ****
Karsten Hopp 252336
  {
Karsten Hopp 252336
      char_u	*key;
Karsten Hopp 252336
      typval_T	tv;
Karsten Hopp 252336
!     dict_T	*d = self->dict;
Karsten Hopp 252336
      dictitem_T	*di;
Karsten Hopp 252336
      DICTKEY_DECL
Karsten Hopp 252336
  
Karsten Hopp 252336
!     if (d->dv_lock)
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_SetVim(_("dict is locked"));
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
--- 970,980 ----
Karsten Hopp 252336
  {
Karsten Hopp 252336
      char_u	*key;
Karsten Hopp 252336
      typval_T	tv;
Karsten Hopp 252336
!     dict_T	*dict = self->dict;
Karsten Hopp 252336
      dictitem_T	*di;
Karsten Hopp 252336
      DICTKEY_DECL
Karsten Hopp 252336
  
Karsten Hopp 252336
!     if (dict->dv_lock)
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_SetVim(_("dict is locked"));
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 982,988 ****
Karsten Hopp 252336
  
Karsten Hopp 252336
      DICTKEY_GET_NOTEMPTY(-1)
Karsten Hopp 252336
  
Karsten Hopp 252336
!     di = dict_find(d, key, -1);
Karsten Hopp 252336
  
Karsten Hopp 252336
      if (valObject == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
--- 982,988 ----
Karsten Hopp 252336
  
Karsten Hopp 252336
      DICTKEY_GET_NOTEMPTY(-1)
Karsten Hopp 252336
  
Karsten Hopp 252336
!     di = dict_find(dict, key, -1);
Karsten Hopp 252336
  
Karsten Hopp 252336
      if (valObject == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 994,1001 ****
Karsten Hopp 252336
  	    PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  	}
Karsten Hopp 252336
! 	hi = hash_find(&d->dv_hashtab, di->di_key);
Karsten Hopp 252336
! 	hash_remove(&d->dv_hashtab, hi);
Karsten Hopp 252336
  	dictitem_free(di);
Karsten Hopp 252336
  	return 0;
Karsten Hopp 252336
      }
Karsten Hopp 252336
--- 994,1001 ----
Karsten Hopp 252336
  	    PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  	}
Karsten Hopp 252336
! 	hi = hash_find(&dict->dv_hashtab, di->di_key);
Karsten Hopp 252336
! 	hash_remove(&dict->dv_hashtab, hi);
Karsten Hopp 252336
  	dictitem_free(di);
Karsten Hopp 252336
  	return 0;
Karsten Hopp 252336
      }
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 1013,1019 ****
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	di->di_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (dict_add(d, di) == FAIL)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    DICTKEY_UNREF
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
--- 1013,1019 ----
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	di->di_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (dict_add(dict, di) == FAIL)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    DICTKEY_UNREF
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 1102,1108 ****
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! list_py_concat(list_T *l, PyObject *obj, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      Py_ssize_t	i;
Karsten Hopp 252336
      Py_ssize_t	lsize = PySequence_Size(obj);
Karsten Hopp 252336
--- 1102,1108 ----
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! list_py_concat(list_T *l, PyObject *obj, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      Py_ssize_t	i;
Karsten Hopp 252336
      Py_ssize_t	lsize = PySequence_Size(obj);
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 1122,1128 ****
Karsten Hopp 252336
  	litem = PySequence_GetItem(obj, i);
Karsten Hopp 252336
  	if (litem == NULL)
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(litem, &li->li_tv, lookupDict) == -1)
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  
Karsten Hopp 252336
  	list_append(l, li);
Karsten Hopp 252336
--- 1122,1128 ----
Karsten Hopp 252336
  	litem = PySequence_GetItem(obj, i);
Karsten Hopp 252336
  	if (litem == NULL)
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(litem, &li->li_tv, lookup_dict) == -1)
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  
Karsten Hopp 252336
  	list_append(l, li);
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4009,4032 ****
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
!     dict_T	*d;
Karsten Hopp 252336
      char_u	*key;
Karsten Hopp 252336
      dictitem_T	*di;
Karsten Hopp 252336
      PyObject	*keyObject;
Karsten Hopp 252336
      PyObject	*valObject;
Karsten Hopp 252336
      Py_ssize_t	iter = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
!     d = dict_alloc();
Karsten Hopp 252336
!     if (d == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_NoMemory();
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
      }
Karsten Hopp 252336
  
Karsten Hopp 252336
      tv->v_type = VAR_DICT;
Karsten Hopp 252336
!     tv->vval.v_dict = d;
Karsten Hopp 252336
  
Karsten Hopp 252336
      while (PyDict_Next(obj, &iter, &keyObject, &valObject))
Karsten Hopp 252336
      {
Karsten Hopp 252336
--- 4009,4032 ----
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
!     dict_T	*dict;
Karsten Hopp 252336
      char_u	*key;
Karsten Hopp 252336
      dictitem_T	*di;
Karsten Hopp 252336
      PyObject	*keyObject;
Karsten Hopp 252336
      PyObject	*valObject;
Karsten Hopp 252336
      Py_ssize_t	iter = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
!     dict = dict_alloc();
Karsten Hopp 252336
!     if (dict == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_NoMemory();
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
      }
Karsten Hopp 252336
  
Karsten Hopp 252336
      tv->v_type = VAR_DICT;
Karsten Hopp 252336
!     tv->vval.v_dict = dict;
Karsten Hopp 252336
  
Karsten Hopp 252336
      while (PyDict_Next(obj, &iter, &keyObject, &valObject))
Karsten Hopp 252336
      {
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4050,4061 ****
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	di->di_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(valObject, &di->di_tv, lookupDict) == -1)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  	}
Karsten Hopp 252336
! 	if (dict_add(d, di) == FAIL)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp 252336
--- 4050,4062 ----
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	di->di_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  	}
Karsten Hopp 252336
! 
Karsten Hopp 252336
! 	if (dict_add(dict, di) == FAIL)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4066,4074 ****
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
!     dict_T	*d;
Karsten Hopp 252336
      char_u	*key;
Karsten Hopp 252336
      dictitem_T	*di;
Karsten Hopp 252336
      PyObject	*list;
Karsten Hopp 252336
--- 4067,4075 ----
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
!     dict_T	*dict;
Karsten Hopp 252336
      char_u	*key;
Karsten Hopp 252336
      dictitem_T	*di;
Karsten Hopp 252336
      PyObject	*list;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4077,4091 ****
Karsten Hopp 252336
      PyObject	*valObject;
Karsten Hopp 252336
      Py_ssize_t	lsize;
Karsten Hopp 252336
  
Karsten Hopp 252336
!     d = dict_alloc();
Karsten Hopp 252336
!     if (d == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_NoMemory();
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
      }
Karsten Hopp 252336
  
Karsten Hopp 252336
      tv->v_type = VAR_DICT;
Karsten Hopp 252336
!     tv->vval.v_dict = d;
Karsten Hopp 252336
  
Karsten Hopp 252336
      list = PyMapping_Items(obj);
Karsten Hopp 252336
      if (list == NULL)
Karsten Hopp 252336
--- 4078,4092 ----
Karsten Hopp 252336
      PyObject	*valObject;
Karsten Hopp 252336
      Py_ssize_t	lsize;
Karsten Hopp 252336
  
Karsten Hopp 252336
!     dict = dict_alloc();
Karsten Hopp 252336
!     if (dict == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_NoMemory();
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
      }
Karsten Hopp 252336
  
Karsten Hopp 252336
      tv->v_type = VAR_DICT;
Karsten Hopp 252336
!     tv->vval.v_dict = dict;
Karsten Hopp 252336
  
Karsten Hopp 252336
      list = PyMapping_Items(obj);
Karsten Hopp 252336
      if (list == NULL)
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4133,4146 ****
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	di->di_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(valObject, &di->di_tv, lookupDict) == -1)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    Py_DECREF(list);
Karsten Hopp 252336
  	    Py_DECREF(litem);
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  	}
Karsten Hopp 252336
! 	if (dict_add(d, di) == FAIL)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    Py_DECREF(list);
Karsten Hopp 252336
--- 4134,4147 ----
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	di->di_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    Py_DECREF(list);
Karsten Hopp 252336
  	    Py_DECREF(litem);
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  	}
Karsten Hopp 252336
! 	if (dict_add(dict, di) == FAIL)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    vim_free(di);
Karsten Hopp 252336
  	    Py_DECREF(list);
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4155,4161 ****
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      list_T	*l;
Karsten Hopp 252336
  
Karsten Hopp 252336
--- 4156,4162 ----
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      list_T	*l;
Karsten Hopp 252336
  
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4169,4182 ****
Karsten Hopp 252336
      tv->v_type = VAR_LIST;
Karsten Hopp 252336
      tv->vval.v_list = l;
Karsten Hopp 252336
  
Karsten Hopp 252336
!     if (list_py_concat(l, obj, lookupDict) == -1)
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
  
Karsten Hopp 252336
      return 0;
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      PyObject	*iterator = PyObject_GetIter(obj);
Karsten Hopp 252336
      PyObject	*item;
Karsten Hopp 252336
--- 4170,4183 ----
Karsten Hopp 252336
      tv->v_type = VAR_LIST;
Karsten Hopp 252336
      tv->vval.v_list = l;
Karsten Hopp 252336
  
Karsten Hopp 252336
!     if (list_py_concat(l, obj, lookup_dict) == -1)
Karsten Hopp 252336
  	return -1;
Karsten Hopp 252336
  
Karsten Hopp 252336
      return 0;
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      PyObject	*iterator = PyObject_GetIter(obj);
Karsten Hopp 252336
      PyObject	*item;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4208,4214 ****
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	li->li_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(item, &li->li_tv, lookupDict) == -1)
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  
Karsten Hopp 252336
  	list_append(l, li);
Karsten Hopp 252336
--- 4209,4215 ----
Karsten Hopp 252336
  	}
Karsten Hopp 252336
  	li->li_tv.v_lock = 0;
Karsten Hopp 252336
  
Karsten Hopp 252336
! 	if (_ConvertFromPyObject(item, &li->li_tv, lookup_dict) == -1)
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
  
Karsten Hopp 252336
  	list_append(l, li);
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4224,4230 ****
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
  convert_dl(PyObject *obj, typval_T *tv,
Karsten Hopp 252336
! 				    pytotvfunc py_to_tv, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      PyObject	*capsule;
Karsten Hopp 252336
      char	hexBuf[sizeof(void *) * 2 + 3];
Karsten Hopp 252336
--- 4225,4231 ----
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
  convert_dl(PyObject *obj, typval_T *tv,
Karsten Hopp 252336
! 				    pytotvfunc py_to_tv, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      PyObject	*capsule;
Karsten Hopp 252336
      char	hexBuf[sizeof(void *) * 2 + 3];
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4232,4240 ****
Karsten Hopp 252336
      sprintf(hexBuf, "%p", obj);
Karsten Hopp 252336
  
Karsten Hopp 252336
  # ifdef PY_USE_CAPSULE
Karsten Hopp 252336
!     capsule = PyDict_GetItemString(lookupDict, hexBuf);
Karsten Hopp 252336
  # else
Karsten Hopp 252336
!     capsule = (PyObject *)PyDict_GetItemString(lookupDict, hexBuf);
Karsten Hopp 252336
  # endif
Karsten Hopp 252336
      if (capsule == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
--- 4233,4241 ----
Karsten Hopp 252336
      sprintf(hexBuf, "%p", obj);
Karsten Hopp 252336
  
Karsten Hopp 252336
  # ifdef PY_USE_CAPSULE
Karsten Hopp 252336
!     capsule = PyDict_GetItemString(lookup_dict, hexBuf);
Karsten Hopp 252336
  # else
Karsten Hopp 252336
!     capsule = (PyObject *)PyDict_GetItemString(lookup_dict, hexBuf);
Karsten Hopp 252336
  # endif
Karsten Hopp 252336
      if (capsule == NULL)
Karsten Hopp 252336
      {
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4243,4251 ****
Karsten Hopp 252336
  # else
Karsten Hopp 252336
  	capsule = PyCObject_FromVoidPtr(tv, NULL);
Karsten Hopp 252336
  # endif
Karsten Hopp 252336
! 	PyDict_SetItemString(lookupDict, hexBuf, capsule);
Karsten Hopp 252336
  	Py_DECREF(capsule);
Karsten Hopp 252336
! 	if (py_to_tv(obj, tv, lookupDict) == -1)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    tv->v_type = VAR_UNKNOWN;
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
--- 4244,4252 ----
Karsten Hopp 252336
  # else
Karsten Hopp 252336
  	capsule = PyCObject_FromVoidPtr(tv, NULL);
Karsten Hopp 252336
  # endif
Karsten Hopp 252336
! 	PyDict_SetItemString(lookup_dict, hexBuf, capsule);
Karsten Hopp 252336
  	Py_DECREF(capsule);
Karsten Hopp 252336
! 	if (py_to_tv(obj, tv, lookup_dict) == -1)
Karsten Hopp 252336
  	{
Karsten Hopp 252336
  	    tv->v_type = VAR_UNKNOWN;
Karsten Hopp 252336
  	    return -1;
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4285,4291 ****
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      if (obj->ob_type == &DictionaryType)
Karsten Hopp 252336
      {
Karsten Hopp 252336
--- 4286,4292 ----
Karsten Hopp 252336
  }
Karsten Hopp 252336
  
Karsten Hopp 252336
      static int
Karsten Hopp 252336
! _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
Karsten Hopp 252336
  {
Karsten Hopp 252336
      if (obj->ob_type == &DictionaryType)
Karsten Hopp 252336
      {
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4357,4363 ****
Karsten Hopp 252336
  	tv->vval.v_number = (varnumber_T) PyLong_AsLong(obj);
Karsten Hopp 252336
      }
Karsten Hopp 252336
      else if (PyDict_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pydict_to_tv, lookupDict);
Karsten Hopp 252336
  #ifdef FEAT_FLOAT
Karsten Hopp 252336
      else if (PyFloat_Check(obj))
Karsten Hopp 252336
      {
Karsten Hopp 252336
--- 4358,4364 ----
Karsten Hopp 252336
  	tv->vval.v_number = (varnumber_T) PyLong_AsLong(obj);
Karsten Hopp 252336
      }
Karsten Hopp 252336
      else if (PyDict_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pydict_to_tv, lookup_dict);
Karsten Hopp 252336
  #ifdef FEAT_FLOAT
Karsten Hopp 252336
      else if (PyFloat_Check(obj))
Karsten Hopp 252336
      {
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 4366,4376 ****
Karsten Hopp 252336
      }
Karsten Hopp 252336
  #endif
Karsten Hopp 252336
      else if (PyIter_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pyiter_to_tv, lookupDict);
Karsten Hopp 252336
      else if (PySequence_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pyseq_to_tv, lookupDict);
Karsten Hopp 252336
      else if (PyMapping_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pymap_to_tv, lookupDict);
Karsten Hopp 252336
      else
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 252336
--- 4367,4377 ----
Karsten Hopp 252336
      }
Karsten Hopp 252336
  #endif
Karsten Hopp 252336
      else if (PyIter_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pyiter_to_tv, lookup_dict);
Karsten Hopp 252336
      else if (PySequence_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
Karsten Hopp 252336
      else if (PyMapping_Check(obj))
Karsten Hopp 252336
! 	return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
Karsten Hopp 252336
      else
Karsten Hopp 252336
      {
Karsten Hopp 252336
  	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 252336
*** ../vim-7.3.1047/src/version.c	2013-05-29 22:36:06.000000000 +0200
Karsten Hopp 252336
--- src/version.c	2013-05-29 22:38:23.000000000 +0200
Karsten Hopp 252336
***************
Karsten Hopp 252336
*** 730,731 ****
Karsten Hopp 252336
--- 730,733 ----
Karsten Hopp 252336
  {   /* Add new patch number below this line */
Karsten Hopp 252336
+ /**/
Karsten Hopp 252336
+     1048,
Karsten Hopp 252336
  /**/
Karsten Hopp 252336
Karsten Hopp 252336
-- 
Karsten Hopp 252336
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 252336
23. You can't call your mother...she doesn't have a modem.
Karsten Hopp 252336
Karsten Hopp 252336
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 252336
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 252336
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 252336
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///