Repository navigation
Support PEP 810 lazy imports (Python 3.15) - #2094
Merged
Merged
Conversation
With lazy imports enabled globally (`-X lazy_imports=all` or `PYTHON_LAZY_IMPORTS=all`), module-level imports can be deferred until first use, which breaks the places where debugpy relies on import side effects. `force_pydevd` never runs, and the vendored pydevd modules and `attach_pid_injected` are only resolved after their directories have been removed from `sys.path`, so debugpy fails to start or attach. `vendored()` now switches lazy imports to `"normal"` while the vendored project is on `sys.path`, and the side-effect imports use `__import__()`, which is never deferred. `tests/debugpy/test_lazy_imports.py` runs every runner with `PYTHON_LAZY_IMPORTS=all`.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Rich Chiodo (rchiodo)
approved these changes
Nov 10, 2026
Contributor
|
Finn Womack (@finnagin), we might need this for debugpy v2? |
Contributor
Author
Rich Chiodo (@rchiodo) can you share any information about debugpy v2? Is it related to the |
Contributor
Yes it's related to that branch. I don't know if I can say anything more than that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With lazy imports enabled globally (
-X lazy_imports=allorPYTHON_LAZY_IMPORTS=all), module-level imports can be deferred until first use, which breaks the places where debugpy relies on import side effects.force_pydevdnever runs, and the vendored pydevd modules andattach_pid_injectedare only resolved after their directories have been removed fromsys.path, so debugpy fails to start or attach.vendored()now switches lazy imports to"normal"while the vendored project is onsys.path, and the side-effect imports use__import__(), which is never deferred.tests/debugpy/test_lazy_imports.pyruns every runner withPYTHON_LAZY_IMPORTS=all.