astepano / rpms / vim

Forked from rpms/vim 6 years ago
Clone
bb267a3
To: vim-dev@vim.org
bb267a3
Subject: Patch 7.2.045
bb267a3
Fcc: outbox
bb267a3
From: Bram Moolenaar <Bram@moolenaar.net>
bb267a3
Mime-Version: 1.0
bb267a3
Content-Type: text/plain; charset=ISO-8859-1
bb267a3
Content-Transfer-Encoding: 8bit
bb267a3
------------
bb267a3
bb267a3
Patch 7.2.045
bb267a3
Problem:    The Python interface has an empty entry in sys.path.
bb267a3
Solution:   Filter out the empty entry. (idea from James Vega)
bb267a3
Files:	    src/if_python.c
bb267a3
bb267a3
bb267a3
*** ../vim-7.2.044/src/if_python.c	Thu Jul 24 16:24:48 2008
bb267a3
--- src/if_python.c	Thu Nov 20 11:03:53 2008
bb267a3
***************
bb267a3
*** 531,536 ****
bb267a3
--- 531,542 ----
bb267a3
  	if (PythonMod_Init())
bb267a3
  	    goto fail;
bb267a3
  
bb267a3
+ 	/* Remove the element from sys.path that was added because of our
bb267a3
+ 	 * argv[0] value in PythonMod_Init().  Previously we used an empty
bb267a3
+ 	 * string, but dependinding on the OS we then get an empty entry or
bb267a3
+ 	 * the current directory in sys.path. */
bb267a3
+ 	PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
bb267a3
+ 
bb267a3
  	/* the first python thread is vim's, release the lock */
bb267a3
  	Python_SaveThread();
bb267a3
  
bb267a3
***************
bb267a3
*** 2345,2351 ****
bb267a3
  {
bb267a3
      PyObject *mod;
bb267a3
      PyObject *dict;
bb267a3
!     static char *(argv[2]) = {"", NULL};
bb267a3
  
bb267a3
      /* Fixups... */
bb267a3
      BufferType.ob_type = &PyType_Type;
bb267a3
--- 2351,2358 ----
bb267a3
  {
bb267a3
      PyObject *mod;
bb267a3
      PyObject *dict;
bb267a3
!     /* The special value is removed from sys.path in Python_Init(). */
bb267a3
!     static char *(argv[2]) = {"/must>not&exist/foo", NULL};
bb267a3
  
bb267a3
      /* Fixups... */
bb267a3
      BufferType.ob_type = &PyType_Type;
bb267a3
*** ../vim-7.2.044/src/version.c	Thu Nov 20 10:36:04 2008
bb267a3
--- src/version.c	Thu Nov 20 10:58:11 2008
bb267a3
***************
bb267a3
*** 678,679 ****
bb267a3
--- 678,681 ----
bb267a3
  {   /* Add new patch number below this line */
bb267a3
+ /**/
bb267a3
+     45,
bb267a3
  /**/
bb267a3
bb267a3
-- 
bb267a3
press CTRL-ALT-DEL for more information
bb267a3
bb267a3
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
bb267a3
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
bb267a3
\\\        download, build and distribute -- http://www.A-A-P.org        ///
bb267a3
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///