To: vim_dev@googlegroups.com
Subject: Patch 7.3.670
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.670
Problem:    Python: memory leaks when there are exceptions.
Solution:   Add DICTKEY_UNREF in the right places. (ZyX)
Files:	    src/if_py_both.h


*** ../vim-7.3.669/src/if_py_both.h	2012-09-12 20:21:38.000000000 +0200
--- src/if_py_both.h	2012-09-21 13:32:13.000000000 +0200
***************
*** 799,812 ****
  
      di = dict_find(((DictionaryObject *) (self))->dict, key, -1);
  
      if (di == NULL)
      {
  	PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
  	return NULL;
      }
  
-     DICTKEY_UNREF
- 
      return ConvertToPyObject(&di->di_tv);
  }
  
--- 799,812 ----
  
      di = dict_find(((DictionaryObject *) (self))->dict, key, -1);
  
+     DICTKEY_UNREF
+ 
      if (di == NULL)
      {
  	PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
  	return NULL;
      }
  
      return ConvertToPyObject(&di->di_tv);
  }
  
***************
*** 835,840 ****
--- 835,841 ----
  
  	if (di == NULL)
  	{
+ 	    DICTKEY_UNREF
  	    PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
  	    return -1;
  	}
***************
*** 859,864 ****
--- 860,866 ----
  
  	if (dict_add(d, di) == FAIL)
  	{
+ 	    DICTKEY_UNREF
  	    vim_free(di);
  	    PyErr_SetVim(_("failed to add key to dictionary"));
  	    return -1;
*** ../vim-7.3.669/src/version.c	2012-09-21 13:26:44.000000000 +0200
--- src/version.c	2012-09-21 13:42:43.000000000 +0200
***************
*** 721,722 ****
--- 721,724 ----
  {   /* Add new patch number below this line */
+ /**/
+     670,
  /**/

-- 
TALL KNIGHT:   Firstly.  You must get us another shrubbery!
OTHER KNIGHTS: More shrubberies!  More shrubberies for the ex-Knights of Ni!
ARTHUR:        Not another shrubbery -
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
