On Thu, Jul 22, 2010 at 4:43 PM, James Vega <james...@jamessan.com> wrote:
> On Thu, Jul 22, 2010 at 4:29 PM, Bram Moolenaar <b...@moolenaar.net> wrote:
>>
>> James Vega wrote:
>>
>>> On Thu, Jul 22, 2010 at 12:36:27AM -0700, Nico Raffo wrote:
>>> > If Vim is compiled with both --enable-pythoninterp and --enable-
>>> > python3interp, errors occur when importing many python modules. To
>>> > reproduce, compile as described then try something like:
>>> >
>>> > :py import termios
>>> > or
>>> > :py3 import termios
>>> >
>>> > Which gives the error:
>>> >
>>> > ImportError: /usr/lib/python3.1/lib-dynload/termios.so: undefined
>>> > symbol: PyExc_TypeError
>>> >
>>> > This doesn't happen with all modules. Mostly just those with odd .so
>>> > files.
>>>
>>> I had been meaning to check whether something like that would happen
>>> with the Python interfaces.  I saw something similar when testing the
>>> Perl interface.  Does the attached patch fix it?
>>
>> Thanks, I'll include it.  It fixes the problem on my system.
>
> The attached patch corrects how DYNAMIC_PYTHON_DLL is specified so that
> it correctly includes the SONAME (libpython2.6.so.1 instead of
> libpython2.6.so).  The former is always available while the latter is
> typically only available when the relevant -dev package is installed.
>
> I'm looking into the crash that was reported as well, but I'm not sure
> if that can be avoided as long as both interpreters are getting loaded.
> At a quick glance, it seems like if_python may not be handling locking
> properly.  I'll dig into this some more later tonight.

Because we have to use RTLD_GLOBAL (since the C extensions aren't linked
against libpython), it's not safe to use both the Python 2 & 3
interfaces in the same session of Vim.  It looks like the options are
either:

1) Only allow one interface to be enabled at a time.
2) Keep track of whether one of the Python interfaces has been
   initialized and error out if the other one tries to be initialized.

I'd personally prefer the latter since that still allows one to build a
single Vim binary that supports both Python 2 & 3, but only one of the
interfaces can be used per Vim session.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <james...@jamessan.com>

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui