]>
Commit | Line | Data |
---|---|---|
65bfde4c AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.045 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.2.045 | |
11 | Problem: The Python interface has an empty entry in sys.path. | |
12 | Solution: Filter out the empty entry. (idea from James Vega) | |
13 | Files: src/if_python.c | |
14 | ||
15 | ||
16 | *** ../vim-7.2.044/src/if_python.c Thu Jul 24 16:24:48 2008 | |
17 | --- src/if_python.c Thu Nov 20 11:03:53 2008 | |
18 | *************** | |
19 | *** 531,536 **** | |
20 | --- 531,542 ---- | |
21 | if (PythonMod_Init()) | |
22 | goto fail; | |
23 | ||
24 | + /* Remove the element from sys.path that was added because of our | |
25 | + * argv[0] value in PythonMod_Init(). Previously we used an empty | |
26 | + * string, but dependinding on the OS we then get an empty entry or | |
27 | + * the current directory in sys.path. */ | |
28 | + PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)"); | |
29 | + | |
30 | /* the first python thread is vim's, release the lock */ | |
31 | Python_SaveThread(); | |
32 | ||
33 | *************** | |
34 | *** 2345,2351 **** | |
35 | { | |
36 | PyObject *mod; | |
37 | PyObject *dict; | |
38 | ! static char *(argv[2]) = {"", NULL}; | |
39 | ||
40 | /* Fixups... */ | |
41 | BufferType.ob_type = &PyType_Type; | |
42 | --- 2351,2358 ---- | |
43 | { | |
44 | PyObject *mod; | |
45 | PyObject *dict; | |
46 | ! /* The special value is removed from sys.path in Python_Init(). */ | |
47 | ! static char *(argv[2]) = {"/must>not&exist/foo", NULL}; | |
48 | ||
49 | /* Fixups... */ | |
50 | BufferType.ob_type = &PyType_Type; | |
51 | *** ../vim-7.2.044/src/version.c Thu Nov 20 10:36:04 2008 | |
52 | --- src/version.c Thu Nov 20 10:58:11 2008 | |
53 | *************** | |
54 | *** 678,679 **** | |
55 | --- 678,681 ---- | |
56 | { /* Add new patch number below this line */ | |
57 | + /**/ | |
58 | + 45, | |
59 | /**/ | |
60 | ||
61 | -- | |
62 | press CTRL-ALT-DEL for more information | |
63 | ||
64 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
65 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
66 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
67 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |