comparison runtime/doc/if_pyth.txt @ 2560:84ba6293f9d7 vim73

Preparations for 7.3f release.
author Bram Moolenaar <bram@vim.org>
date Fri, 13 Aug 2010 22:05:54 +0200
parents 7abef60aca22
children 1851bce339fc
comparison
equal deleted inserted replaced
2559:7850c8c12347 2560:84ba6293f9d7
333 The name of the DLL must match the Python version Vim was compiled with. 333 The name of the DLL must match the Python version Vim was compiled with.
334 Currently the name is "python24.dll". That is for Python 2.4. To know for 334 Currently the name is "python24.dll". That is for Python 2.4. To know for
335 sure edit "gvim.exe" and search for "python\d*.dll\c". 335 sure edit "gvim.exe" and search for "python\d*.dll\c".
336 336
337 ============================================================================== 337 ==============================================================================
338 7. Python 3 *python3* 338 7. Python 3 *python3*
339 339
340 *:py3* *:python3* 340 *:py3* *:python3*
341 The |:py3| and |:python3| commands work similar to |:python|. 341 The |:py3| and |:python3| commands work similar to |:python|.
342 *:py3file* 342 *:py3file*
343 The |:py3file| command works similar to |:pyfile|. 343 The |:py3file| command works similar to |:pyfile|.
344 344
345 Vim can be built in four ways (:version output): 345 Vim can be built in four ways (:version output):
346 1. No Python support (-python, -python3) 346 1. No Python support (-python, -python3)
347 2. Python 2 support only (+python or +python/dyn, -python3) 347 2. Python 2 support only (+python or +python/dyn, -python3)
348 3. Python 3 support only (-python, +python3 or +python3/dyn) 348 3. Python 3 support only (-python, +python3 or +python3/dyn)
349 4. Python 2 and 3 support (+python/dyn, +python3/dyn) 349 4. Python 2 and 3 support (+python/dyn, +python3/dyn)
350 350
351 Some more details on the special case 4:
352
353 When Python 2 and Python 3 are both supported they must be loaded dynamically.
354
355 When doing this on Linux/Unix systems and importing global symbols, this leads
356 to a crash when the second Python version is used. So either global symbols
357 are loaded but only one Python version is activated, or no global symbols are
358 loaded. The latter makes Python's "import" fail on libaries that expect the
359 symbols to be provided by Vim.
351 *E836* *E837* 360 *E836* *E837*
352 You can see that when Python 2 and Python 3 are both supported they must be 361 Vim's configuration script makes a guess for all libraries based on one
353 loaded dynamically. Depending on how the libraries have been build it might 362 standard Python library (termios). If importing this library succeeds for
354 be impossible to use ":py3" and ":python" in one Vim session. 363 both Python versions, then both will be made available in Vim at the same
355 364 time. If not, only the version first used in a session will be enabled.
356 On Linux/Unix systems this can only be done without importing global symbols. 365 When trying to use the other one you will get the E836 or E837 error message.
357 In this case python's "import" might fail, if the library expects the symbols 366
358 to be provided by vim. To work around this 367 Here Vim's behavior depends on the system in which it was configured. In a
359 1. either the problematic library, or python in case of standard libraries, 368 system where both versions of Python were configured with --enable-shared,
360 must be recompiled to link to the according libpython.so file 369 both versions of Python will be activated at the same time. There will still
361 (--enable-shared in case of python). 370 be problems with other third party libraries that were not linked to
362 2. Or you recompile vim for only one python version. In this case all symbols 371 libPython.
363 can be imported into vim. 372
373 To work around such problems there are these options:
374 1. The problematic library is recompiled to link to the according
375 libpython.so.
376 2. Vim is recompiled for only one Python version.
377 3. You undefine PY_NO_RTLD_GLOBAL in auto/config.h after configuration. This
378 may crash Vim though.
379
364 380
365 ============================================================================== 381 ==============================================================================
366 vim:tw=78:ts=8:ft=help:norl: 382 vim:tw=78:ts=8:ft=help:norl: