jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.380

073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.380
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.380
073263
Problem:    Loading python may cause Vim to exit.
073263
Solution:   Avoid loading the "site" module. (Taro Muraoka)
073263
Files:	    src/if_python.c
073263
073263
073263
*** ../vim-7.4.379/src/if_python.c	2014-03-30 16:11:37.176530823 +0200
073263
--- src/if_python.c	2014-07-23 16:46:42.863880615 +0200
073263
***************
073263
*** 295,300 ****
073263
--- 295,303 ----
073263
  #  define PyCObject_FromVoidPtr dll_PyCObject_FromVoidPtr
073263
  #  define PyCObject_AsVoidPtr dll_PyCObject_AsVoidPtr
073263
  # endif
073263
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
073263
+ #  define Py_NoSiteFlag (*dll_Py_NoSiteFlag)
073263
+ # endif
073263
  
073263
  /*
073263
   * Pointers for dynamic link
073263
***************
073263
*** 440,445 ****
073263
--- 443,451 ----
073263
  static PyObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void *));
073263
  static void* (*dll_PyCObject_AsVoidPtr)(PyObject *);
073263
  # endif
073263
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
073263
+ static int* dll_Py_NoSiteFlag;
073263
+ # endif
073263
  
073263
  static HINSTANCE hinstPython = 0; /* Instance of python.dll */
073263
  
073263
***************
073263
*** 633,638 ****
073263
--- 639,647 ----
073263
      {"PyCObject_FromVoidPtr", (PYTHON_PROC*)&dll_PyCObject_FromVoidPtr},
073263
      {"PyCObject_AsVoidPtr", (PYTHON_PROC*)&dll_PyCObject_AsVoidPtr},
073263
  # endif
073263
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
073263
+     {"Py_NoSiteFlag", (PYTHON_PROC*)&dll_Py_NoSiteFlag},
073263
+ # endif
073263
      {"", NULL},
073263
  };
073263
  
073263
***************
073263
*** 901,906 ****
073263
--- 910,919 ----
073263
  {
073263
      if (!initialised)
073263
      {
073263
+ #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
073263
+ 	PyObject *site;
073263
+ #endif
073263
+ 
073263
  #ifdef DYNAMIC_PYTHON
073263
  	if (!python_enabled(TRUE))
073263
  	{
073263
***************
073263
*** 915,925 ****
073263
--- 928,956 ----
073263
  
073263
  	init_structs();
073263
  
073263
+ #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
073263
+ 	/* Disable implicit 'import site', because it may cause Vim to exit
073263
+ 	 * when it can't be found. */
073263
+ 	Py_NoSiteFlag++;
073263
+ #endif
073263
+ 
073263
  #if !defined(MACOS) || defined(MACOS_X_UNIX)
073263
  	Py_Initialize();
073263
  #else
073263
  	PyMac_Initialize();
073263
  #endif
073263
+ 
073263
+ #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
073263
+ 	/* 'import site' explicitly. */
073263
+ 	site = PyImport_ImportModule("site");
073263
+ 	if (site == NULL)
073263
+ 	{
073263
+ 	    EMSG(_("E887: Sorry, this command is disabled, the Python's site module could not be loaded."));
073263
+ 	    goto fail;
073263
+ 	}
073263
+ 	Py_DECREF(site);
073263
+ #endif
073263
+ 
073263
  	/* Initialise threads, and below save the state using
073263
  	 * PyEval_SaveThread.  Without the call to PyEval_SaveThread, thread
073263
  	 * specific state (such as the system trace hook), will be lost
073263
*** ../vim-7.4.379/src/version.c	2014-07-23 16:33:04.079886500 +0200
073263
--- src/version.c	2014-07-23 16:43:47.939881872 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     380,
073263
  /**/
073263
073263
-- 
073263
Looking at Perl through Lisp glasses, Perl looks atrocious.
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///