Karsten Hopp c76da7
To: vim_dev@googlegroups.com
Karsten Hopp c76da7
Subject: Patch 7.3.670
Karsten Hopp c76da7
Fcc: outbox
Karsten Hopp c76da7
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c76da7
Mime-Version: 1.0
Karsten Hopp c76da7
Content-Type: text/plain; charset=UTF-8
Karsten Hopp c76da7
Content-Transfer-Encoding: 8bit
Karsten Hopp c76da7
------------
Karsten Hopp c76da7
Karsten Hopp c76da7
Patch 7.3.670
Karsten Hopp c76da7
Problem:    Python: memory leaks when there are exceptions.
Karsten Hopp c76da7
Solution:   Add DICTKEY_UNREF in the right places. (ZyX)
Karsten Hopp c76da7
Files:	    src/if_py_both.h
Karsten Hopp c76da7
Karsten Hopp c76da7
Karsten Hopp c76da7
*** ../vim-7.3.669/src/if_py_both.h	2012-09-12 20:21:38.000000000 +0200
Karsten Hopp c76da7
--- src/if_py_both.h	2012-09-21 13:32:13.000000000 +0200
Karsten Hopp c76da7
***************
Karsten Hopp c76da7
*** 799,812 ****
Karsten Hopp c76da7
  
Karsten Hopp c76da7
      di = dict_find(((DictionaryObject *) (self))->dict, key, -1);
Karsten Hopp c76da7
  
Karsten Hopp c76da7
      if (di == NULL)
Karsten Hopp c76da7
      {
Karsten Hopp c76da7
  	PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
Karsten Hopp c76da7
  	return NULL;
Karsten Hopp c76da7
      }
Karsten Hopp c76da7
  
Karsten Hopp c76da7
-     DICTKEY_UNREF
Karsten Hopp c76da7
- 
Karsten Hopp c76da7
      return ConvertToPyObject(&di->di_tv);
Karsten Hopp c76da7
  }
Karsten Hopp c76da7
  
Karsten Hopp c76da7
--- 799,812 ----
Karsten Hopp c76da7
  
Karsten Hopp c76da7
      di = dict_find(((DictionaryObject *) (self))->dict, key, -1);
Karsten Hopp c76da7
  
Karsten Hopp c76da7
+     DICTKEY_UNREF
Karsten Hopp c76da7
+ 
Karsten Hopp c76da7
      if (di == NULL)
Karsten Hopp c76da7
      {
Karsten Hopp c76da7
  	PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
Karsten Hopp c76da7
  	return NULL;
Karsten Hopp c76da7
      }
Karsten Hopp c76da7
  
Karsten Hopp c76da7
      return ConvertToPyObject(&di->di_tv);
Karsten Hopp c76da7
  }
Karsten Hopp c76da7
  
Karsten Hopp c76da7
***************
Karsten Hopp c76da7
*** 835,840 ****
Karsten Hopp c76da7
--- 835,841 ----
Karsten Hopp c76da7
  
Karsten Hopp c76da7
  	if (di == NULL)
Karsten Hopp c76da7
  	{
Karsten Hopp c76da7
+ 	    DICTKEY_UNREF
Karsten Hopp c76da7
  	    PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
Karsten Hopp c76da7
  	    return -1;
Karsten Hopp c76da7
  	}
Karsten Hopp c76da7
***************
Karsten Hopp c76da7
*** 859,864 ****
Karsten Hopp c76da7
--- 860,866 ----
Karsten Hopp c76da7
  
Karsten Hopp c76da7
  	if (dict_add(d, di) == FAIL)
Karsten Hopp c76da7
  	{
Karsten Hopp c76da7
+ 	    DICTKEY_UNREF
Karsten Hopp c76da7
  	    vim_free(di);
Karsten Hopp c76da7
  	    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp c76da7
  	    return -1;
Karsten Hopp c76da7
*** ../vim-7.3.669/src/version.c	2012-09-21 13:26:44.000000000 +0200
Karsten Hopp c76da7
--- src/version.c	2012-09-21 13:42:43.000000000 +0200
Karsten Hopp c76da7
***************
Karsten Hopp c76da7
*** 721,722 ****
Karsten Hopp c76da7
--- 721,724 ----
Karsten Hopp c76da7
  {   /* Add new patch number below this line */
Karsten Hopp c76da7
+ /**/
Karsten Hopp c76da7
+     670,
Karsten Hopp c76da7
  /**/
Karsten Hopp c76da7
Karsten Hopp c76da7
-- 
Karsten Hopp c76da7
TALL KNIGHT:   Firstly.  You must get us another shrubbery!
Karsten Hopp c76da7
OTHER KNIGHTS: More shrubberies!  More shrubberies for the ex-Knights of Ni!
Karsten Hopp c76da7
ARTHUR:        Not another shrubbery -
Karsten Hopp c76da7
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp c76da7
Karsten Hopp c76da7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c76da7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c76da7
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp c76da7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///