On Wed, Apr 06, 2016 at 09:07:32AM -0700, 'Anatol Pomazau' via vim_dev wrote:
> Here is a followup for this discussion at Arch Linux forum 
> https://bbs.archlinux.org/viewtopic.php?id=210968
>
> Arch recently switched to dynamic language bindings to support both
> python2 and python3 by the same package. It works great except a few
> use-cases. It turned out that some python packages (like python-dbus)
> do not link their packages to python shared library:
>
> $ ldd /usr/lib/python2.7/site-packages/_dbus_bindings.so | grep python
> # compare it to yaml library:
> $ ldd /usr/lib/python2.7/site-packages/_yaml.so | grep python
>       libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007ffa53d88000)
>
> I am not a python guru and not sure why it is done. Does anybody know why it 
> is not linked to libpython2.7.so?

This thread on Python's distutils-sig@ may be relevant:
https://mail.python.org/pipermail/distutils-sig/2016-February/028275.html

> But this enough for vim to crash when this package is loading:
>
> :py import dbus
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/usr/lib/python2.7/site-packages/dbus/__init__.py", line 77, in 
> <module>
>     import dbus.types as types
>   File "/usr/lib/python2.7/site-packages/dbus/types.py", line 6, in <module>
>     from _dbus_bindings import (
> ImportError: /usr/lib/python2.7/site-packages/_dbus_bindings.so: undefined 
> symbol: PyExc_KeyboardInterrupt

Ouch.

> This behavior is different from static language bindings where (it
> seems) python libraries are loaded into namespace by vim itself.
>
> What is the right way to resolve it? Should vim preload python
> libraries when the language binding is used? Or all python libraries
> should be linked to libpython2.7.so?

Perhaps if vim used RTLD_GLOBAL when dlopen'ing libpython that would
make things work?  Apparently that's the workaround that mod_wsgi uses
to fix this exact situation, if I correctly understood
https://mail.python.org/pipermail/distutils-sig/2016-February/028286.html

:h if_pyth.txt describes what to do to try that (undefine
PY_NO_RTLD_GLOBAL in auto/config.h after running ./configure), and what
the downsides are ("may crash Vim", if you attempt to use both :py and
:py3 in the same vim seession).

Marius Gedminas
-- 
Every nonempty totally-disconnected perfect compact metric space is
homeomorphic to the Cantor set.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui