Skip to content

Add lazy loading, improve dyn-stable support - #25

Open
Coacher wants to merge 6 commits into
masterfrom
lazy-load
Open

Coacher wants to merge 6 commits into
masterfrom
lazy-load

Conversation

@Coacher

@Coacher Coacher commented Nov 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

Vim with dynamic Python binds to the Python library on the first Python
command. Delay Python calls as much as possible to help with binding to
the proper version.
On activation the following sequence happens:
1. Find the virtual environment directory: no Python calls
2. Determine the virtual environment Python version: no Python calls
3. Determine the Vim Python version:
   no Python calls with dyn-stable, some Python calls otherwise
4. Change 'pythonthreedll' to match the virtual environment Python

Vim and Neovim can be built against a specific Python version. Vim
exclusively can support a range of Python versions with dyn-stable
feature. With dyn-stable Vim binds to the default Python version upon
the first Python call. 'pythonthreedll' option can make Vim bind to
a specific version instead. Changing it after the bind does nothing.

Since step 3 involve Python calls on non dyn-stable setups, Vim will
bind to the default Python version as required. Binding to another
version will probably lead to crashes and problems.

Since step 3 involve no Python calls on dyn-stable setups, Vim can
bind to the virtual environment Python version. This will prevent
C extensions ABI mismatch, which cannot be mixed between versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant