Karsten Hopp 62864f
To: vim_dev@googlegroups.com
Karsten Hopp 62864f
Subject: Patch 7.3.950
Karsten Hopp 62864f
Fcc: outbox
Karsten Hopp 62864f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 62864f
Mime-Version: 1.0
Karsten Hopp 62864f
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 62864f
Content-Transfer-Encoding: 8bit
Karsten Hopp 62864f
------------
Karsten Hopp 62864f
Karsten Hopp 62864f
Patch 7.3.950
Karsten Hopp 62864f
Problem:    Python: Stack trace printer can't handle messages.
Karsten Hopp 62864f
Solution:   Make KeyErrors use PyErr_SetObject. (ZyX)
Karsten Hopp 62864f
Files:	    src/if_py_both.h, src/if_python3.c, src/if_python.c
Karsten Hopp 62864f
Karsten Hopp 62864f
Karsten Hopp 62864f
*** ../vim-7.3.949/src/if_py_both.h	2013-05-15 15:12:25.000000000 +0200
Karsten Hopp 62864f
--- src/if_py_both.h	2013-05-15 15:16:23.000000000 +0200
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 734,740 ****
Karsten Hopp 62864f
  
Karsten Hopp 62864f
      if (di == NULL)
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetString(PyExc_KeyError, _("no such key in dictionary"));
Karsten Hopp 62864f
  	return NULL;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  
Karsten Hopp 62864f
--- 734,740 ----
Karsten Hopp 62864f
  
Karsten Hopp 62864f
      if (di == NULL)
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 62864f
  	return NULL;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 767,773 ****
Karsten Hopp 62864f
  	if (di == NULL)
Karsten Hopp 62864f
  	{
Karsten Hopp 62864f
  	    DICTKEY_UNREF
Karsten Hopp 62864f
! 	    PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
Karsten Hopp 62864f
  	    return -1;
Karsten Hopp 62864f
  	}
Karsten Hopp 62864f
  	hi = hash_find(&d->dv_hashtab, di->di_key);
Karsten Hopp 62864f
--- 767,773 ----
Karsten Hopp 62864f
  	if (di == NULL)
Karsten Hopp 62864f
  	{
Karsten Hopp 62864f
  	    DICTKEY_UNREF
Karsten Hopp 62864f
! 	    PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 62864f
  	    return -1;
Karsten Hopp 62864f
  	}
Karsten Hopp 62864f
  	hi = hash_find(&d->dv_hashtab, di->di_key);
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 1353,1359 ****
Karsten Hopp 62864f
  
Karsten Hopp 62864f
      if (flags == 0)
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetString(PyExc_KeyError, "Option does not exist in given scope");
Karsten Hopp 62864f
  	return NULL;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  
Karsten Hopp 62864f
--- 1353,1359 ----
Karsten Hopp 62864f
  
Karsten Hopp 62864f
      if (flags == 0)
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 62864f
  	return NULL;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 1447,1453 ****
Karsten Hopp 62864f
  
Karsten Hopp 62864f
      if (flags == 0)
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetString(PyExc_KeyError, "Option does not exist in given scope");
Karsten Hopp 62864f
  	return -1;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  
Karsten Hopp 62864f
--- 1447,1453 ----
Karsten Hopp 62864f
  
Karsten Hopp 62864f
      if (flags == 0)
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 62864f
  	return -1;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 3145,3151 ****
Karsten Hopp 62864f
  	return BufferNew(b);
Karsten Hopp 62864f
      else
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetString(PyExc_KeyError, _("no such buffer"));
Karsten Hopp 62864f
  	return NULL;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  }
Karsten Hopp 62864f
--- 3145,3151 ----
Karsten Hopp 62864f
  	return BufferNew(b);
Karsten Hopp 62864f
      else
Karsten Hopp 62864f
      {
Karsten Hopp 62864f
! 	PyErr_SetObject(PyExc_KeyError, keyObject);
Karsten Hopp 62864f
  	return NULL;
Karsten Hopp 62864f
      }
Karsten Hopp 62864f
  }
Karsten Hopp 62864f
*** ../vim-7.3.949/src/if_python3.c	2013-05-15 15:12:25.000000000 +0200
Karsten Hopp 62864f
--- src/if_python3.c	2013-05-15 15:16:23.000000000 +0200
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 128,133 ****
Karsten Hopp 62864f
--- 128,134 ----
Karsten Hopp 62864f
  # define PyErr_Occurred py3_PyErr_Occurred
Karsten Hopp 62864f
  # define PyErr_SetNone py3_PyErr_SetNone
Karsten Hopp 62864f
  # define PyErr_SetString py3_PyErr_SetString
Karsten Hopp 62864f
+ # define PyErr_SetObject py3_PyErr_SetObject
Karsten Hopp 62864f
  # define PyEval_InitThreads py3_PyEval_InitThreads
Karsten Hopp 62864f
  # define PyEval_RestoreThread py3_PyEval_RestoreThread
Karsten Hopp 62864f
  # define PyEval_SaveThread py3_PyEval_SaveThread
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 250,255 ****
Karsten Hopp 62864f
--- 251,257 ----
Karsten Hopp 62864f
  static PyObject* (*py3_PyErr_NoMemory)(void);
Karsten Hopp 62864f
  static void (*py3_Py_Finalize)(void);
Karsten Hopp 62864f
  static void (*py3_PyErr_SetString)(PyObject *, const char *);
Karsten Hopp 62864f
+ static void (*py3_PyErr_SetObject)(PyObject *, PyObject *);
Karsten Hopp 62864f
  static int (*py3_PyRun_SimpleString)(char *);
Karsten Hopp 62864f
  static PyObject* (*py3_PyRun_String)(char *, int, PyObject *, PyObject *);
Karsten Hopp 62864f
  static PyObject* (*py3_PyList_GetItem)(PyObject *, Py_ssize_t);
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 379,384 ****
Karsten Hopp 62864f
--- 381,387 ----
Karsten Hopp 62864f
      {"PyErr_NoMemory", (PYTHON_PROC*)&py3_PyErr_NoMemory},
Karsten Hopp 62864f
      {"Py_Finalize", (PYTHON_PROC*)&py3_Py_Finalize},
Karsten Hopp 62864f
      {"PyErr_SetString", (PYTHON_PROC*)&py3_PyErr_SetString},
Karsten Hopp 62864f
+     {"PyErr_SetObject", (PYTHON_PROC*)&py3_PyErr_SetObject},
Karsten Hopp 62864f
      {"PyRun_SimpleString", (PYTHON_PROC*)&py3_PyRun_SimpleString},
Karsten Hopp 62864f
      {"PyRun_String", (PYTHON_PROC*)&py3_PyRun_String},
Karsten Hopp 62864f
      {"PyList_GetItem", (PYTHON_PROC*)&py3_PyList_GetItem},
Karsten Hopp 62864f
*** ../vim-7.3.949/src/if_python.c	2013-05-15 15:12:25.000000000 +0200
Karsten Hopp 62864f
--- src/if_python.c	2013-05-15 15:16:23.000000000 +0200
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 155,160 ****
Karsten Hopp 62864f
--- 155,161 ----
Karsten Hopp 62864f
  # define PyErr_Occurred dll_PyErr_Occurred
Karsten Hopp 62864f
  # define PyErr_SetNone dll_PyErr_SetNone
Karsten Hopp 62864f
  # define PyErr_SetString dll_PyErr_SetString
Karsten Hopp 62864f
+ # define PyErr_SetObject dll_PyErr_SetObject
Karsten Hopp 62864f
  # define PyEval_InitThreads dll_PyEval_InitThreads
Karsten Hopp 62864f
  # define PyEval_RestoreThread dll_PyEval_RestoreThread
Karsten Hopp 62864f
  # define PyEval_SaveThread dll_PyEval_SaveThread
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 260,265 ****
Karsten Hopp 62864f
--- 261,267 ----
Karsten Hopp 62864f
  static PyObject*(*dll_PyErr_Occurred)(void);
Karsten Hopp 62864f
  static void(*dll_PyErr_SetNone)(PyObject *);
Karsten Hopp 62864f
  static void(*dll_PyErr_SetString)(PyObject *, const char *);
Karsten Hopp 62864f
+ static void(*dll_PyErr_SetObject)(PyObject *, PyObject *);
Karsten Hopp 62864f
  static void(*dll_PyEval_InitThreads)(void);
Karsten Hopp 62864f
  static void(*dll_PyEval_RestoreThread)(PyThreadState *);
Karsten Hopp 62864f
  static PyThreadState*(*dll_PyEval_SaveThread)(void);
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 393,398 ****
Karsten Hopp 62864f
--- 395,401 ----
Karsten Hopp 62864f
      {"PyErr_Occurred", (PYTHON_PROC*)&dll_PyErr_Occurred},
Karsten Hopp 62864f
      {"PyErr_SetNone", (PYTHON_PROC*)&dll_PyErr_SetNone},
Karsten Hopp 62864f
      {"PyErr_SetString", (PYTHON_PROC*)&dll_PyErr_SetString},
Karsten Hopp 62864f
+     {"PyErr_SetObject", (PYTHON_PROC*)&dll_PyErr_SetObject},
Karsten Hopp 62864f
      {"PyEval_InitThreads", (PYTHON_PROC*)&dll_PyEval_InitThreads},
Karsten Hopp 62864f
      {"PyEval_RestoreThread", (PYTHON_PROC*)&dll_PyEval_RestoreThread},
Karsten Hopp 62864f
      {"PyEval_SaveThread", (PYTHON_PROC*)&dll_PyEval_SaveThread},
Karsten Hopp 62864f
*** ../vim-7.3.949/src/version.c	2013-05-15 15:12:25.000000000 +0200
Karsten Hopp 62864f
--- src/version.c	2013-05-15 15:17:56.000000000 +0200
Karsten Hopp 62864f
***************
Karsten Hopp 62864f
*** 730,731 ****
Karsten Hopp 62864f
--- 730,733 ----
Karsten Hopp 62864f
  {   /* Add new patch number below this line */
Karsten Hopp 62864f
+ /**/
Karsten Hopp 62864f
+     950,
Karsten Hopp 62864f
  /**/
Karsten Hopp 62864f
Karsten Hopp 62864f
-- 
Karsten Hopp 62864f
-rwxr-xr-x  1 root          24 Oct 29  1929 /bin/ed
Karsten Hopp 62864f
-rwxr-xr-t  4 root      131720 Jan  1  1970 /usr/ucb/vi
Karsten Hopp 62864f
-rwxr-xr-x  1 root  5.89824e37 Oct 22  1990 /usr/bin/emacs
Karsten Hopp 62864f
Karsten Hopp 62864f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 62864f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 62864f
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 62864f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///