<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 3, 2013 at 8:59 AM, R. David Murray <span dir="ltr"><<a href="mailto:rdmurray@bitdance.com" target="_blank">rdmurray@bitdance.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I came across this in the VIM documentation:<br>
<br>
    Vim can be built in four ways (:version output):<br>
    1. No Python support        (-python, -python3)<br>
    2. Python 2 support only    (+python or +python/dyn, -python3)<br>
    3. Python 3 support only    (-python, +python3 or +python3/dyn)<br>
    4. Python 2 and 3 support   (+python/dyn, +python3/dyn)<br>
<br>
    Some more details on the special case 4:<br>
<br>
    When Python 2 and Python 3 are both supported they must be loaded dynamically.<br>
<br>
    When doing this on Linux/Unix systems and importing global symbols, this leads<br>
    to a crash when the second Python version is used.  So either global symbols<br>
    are loaded but only one Python version is activated, or no global symbols are<br>
    loaded. The latter makes Python's "import" fail on libraries that expect the<br>
    symbols to be provided by Vim.<br>
<br>
I've never played with embedding Python.  Does this make sense to<br>
anyone who has?  Is there some limitation in our embedding and/or<br>
import machinery here, or is this more likely to be a shortcoming on<br>
the VIM side?<br>
<br>
Mostly I'm asking out of curiosity in hopes of learning something;<br>
I doubt I'll have enough motivation to make time to work on solving this.<br></blockquote><div><br></div><div>I'm not used to it being possible to have multiple different embedded Python interpreters in one process at all. The Python C API symbols exported by one python interpreter will conflict with another python interpreter. We don't provide isolation of interpreters within a process. IIRC, if you do have multiple even of the same version within a single process they are still all sharing the same python memory allocator pools and GIL and more.</div>

<div><br></div><div>That someone even went through the hoops to attempt to get vim to allow having some semblance of both python 2 and python 3 embedded dynamically at runtime seems like overkill to me.</div><div><br></div>

<div>Pick one and go with it. Vim should declare at some point in 2014 that the embedded Python in vim is now Python 3 only and move on. The rare users who actually use the embedded bazillion scripting languages within vim will need to update their code, ideally to be 2 and 3 compatible.</div>

<div><br></div><div>-gps</div></div></div></div>