gh-69686: Remove untrue part of __import__ replacement docs#143261
Merged
hauntsaninja merged 1 commit intopython:mainfrom Dec 30, 2025
Merged
gh-69686: Remove untrue part of __import__ replacement docs#143261hauntsaninja merged 1 commit intopython:mainfrom
__import__ replacement docs#143261hauntsaninja merged 1 commit intopython:mainfrom
Conversation
The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in python#69686.
aisk
approved these changes
Dec 29, 2025
hauntsaninja
approved these changes
Dec 30, 2025
Contributor
hauntsaninja
left a comment
There was a problem hiding this comment.
Good spot, thank you!
|
Thanks @Sachaa-Thanasius for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Dec 30, 2025
…ythonGH-143261) Remove untrue part of `__import__` replacement docs The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in python#69686. (cherry picked from commit 79c03ac) Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Dec 30, 2025
…ythonGH-143261) Remove untrue part of `__import__` replacement docs The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in python#69686. (cherry picked from commit 79c03ac) Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
|
GH-143281 is a backport of this pull request to the 3.14 branch. |
|
GH-143282 is a backport of this pull request to the 3.13 branch. |
hauntsaninja
pushed a commit
that referenced
this pull request
Dec 30, 2025
…H-143261) (#143281) gh-69686: Remove untrue part of `__import__` replacement docs (GH-143261) Remove untrue part of `__import__` replacement docs The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in #69686. (cherry picked from commit 79c03ac) Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
hauntsaninja
pushed a commit
that referenced
this pull request
Dec 30, 2025
…H-143261) (#143282) gh-69686: Remove untrue part of `__import__` replacement docs (GH-143261) Remove untrue part of `__import__` replacement docs The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in #69686. (cherry picked from commit 79c03ac) Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
thunder-coding
pushed a commit
to thunder-coding/cpython
that referenced
this pull request
Feb 15, 2026
…ython#143261) Remove untrue part of `__import__` replacement docs The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in python#69686.
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.
As far as I know (and based on the information in the linked issue), this statement in the docs hasn't been true since at least Python 2.7.
📚 Documentation preview 📚: https://cpython-previews--143261.org.readthedocs.build/