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