To: vim_dev@googlegroups.com
Subject: Patch 7.3.683
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.683
Problem:    ":python" may crash when vimbindeval() returns None.
Solution:   Check for v_string to be NULL. (Yukihiro Nakadaira)
Files:	    src/if_py_both.h


*** ../vim-7.3.682/src/if_py_both.h	2012-09-21 14:00:05.000000000 +0200
--- src/if_py_both.h	2012-10-05 21:05:06.000000000 +0200
***************
*** 351,357 ****
  
      if (our_tv->v_type == VAR_STRING)
      {
! 	result = Py_BuildValue("s", our_tv->vval.v_string);
      }
      else if (our_tv->v_type == VAR_NUMBER)
      {
--- 351,358 ----
  
      if (our_tv->v_type == VAR_STRING)
      {
! 	result = Py_BuildValue("s", our_tv->vval.v_string == NULL
! 					? "" : (char *)our_tv->vval.v_string);
      }
      else if (our_tv->v_type == VAR_NUMBER)
      {
***************
*** 2751,2757 ****
      switch (tv->v_type)
      {
  	case VAR_STRING:
! 	    return PyBytes_FromString((char *) tv->vval.v_string);
  	case VAR_NUMBER:
  	    return PyLong_FromLong((long) tv->vval.v_number);
  #ifdef FEAT_FLOAT
--- 2752,2759 ----
      switch (tv->v_type)
      {
  	case VAR_STRING:
! 	    return PyBytes_FromString(tv->vval.v_string == NULL
! 					    ? "" : (char *)tv->vval.v_string);
  	case VAR_NUMBER:
  	    return PyLong_FromLong((long) tv->vval.v_number);
  #ifdef FEAT_FLOAT
***************
*** 2763,2769 ****
  	case VAR_DICT:
  	    return DictionaryNew(tv->vval.v_dict);
  	case VAR_FUNC:
! 	    return FunctionNew(tv->vval.v_string);
  	case VAR_UNKNOWN:
  	    Py_INCREF(Py_None);
  	    return Py_None;
--- 2765,2772 ----
  	case VAR_DICT:
  	    return DictionaryNew(tv->vval.v_dict);
  	case VAR_FUNC:
! 	    return FunctionNew(tv->vval.v_string == NULL
! 					  ? (char_u *)"" : tv->vval.v_string);
  	case VAR_UNKNOWN:
  	    Py_INCREF(Py_None);
  	    return Py_None;
*** ../vim-7.3.682/src/version.c	2012-10-04 22:38:32.000000000 +0200
--- src/version.c	2012-10-05 21:04:19.000000000 +0200
***************
*** 721,722 ****
--- 721,724 ----
  {   /* Add new patch number below this line */
+ /**/
+     683,
  /**/

-- 
SIGIRO -- irony detected (iron core dumped)

 /// 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    ///
