New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce pythonhome and pythonthreehome options #1266

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@splhack

splhack commented Nov 22, 2016

It is really difficult to set Python home directory properly for Python
2.7 and 3.5 in .vimrc at the same time since both versions use $PYTHONHOME
environment variable. Introduce pythonhome and pythonthreehome
options in order to set Python home directory via Py_SetPythonHome API
for both versions.

{
int len;
wchar_t *buf;
len = strlen((char *)p_py3home);

This comment has been minimized.

@ichizok

ichizok Nov 23, 2016

I think it is better to calculate len by mbstowcs(NULL, (char *)p_py3home, 0), and it needs + 1 for wide-null terminator.

len = mbstowcs(NULL, (char *)p_py3home, 0);
buf = (wchar_t *)alloc((len + 1) * sizeof(wchar_t));
if (buf && mbstowcs(buf, (char *)p_py3home, len + 1) != (size_t)-1)
    Py_SetPythonHome(buf);
Introduce pythonhome and pythonthreehome options
It is really difficult to set Python home directory properly for Python
2.7 and 3.5 in .vimrc at the same time since both versions use `$PYTHONHOME`
environment variable. Introduce `pythonhome` and `pythonthreehome`
options in order to set Python home directory via `Py_SetPythonHome` API
for both versions.

@brammool brammool closed this in 9407316 Jan 31, 2018

adizero pushed a commit to adizero/vim that referenced this pull request May 19, 2018

patch 8.0.1451: difficult to set the python home directories properly
Problem:    It is difficult to set the python home directory properly for
            Python 2.7 and 3.5 since both use $PYTHONHOME.
Solution:   Add the 'pythonhome' and 'pythonthreehome' options. (Kazuki
            Sakamoto, closes vim#1266)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment