Skip to content

Commit 1a82320

Browse files
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.
1 parent 0efbad6 commit 1a82320

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Doc/reference/import.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,7 @@ entirely with a custom meta path hook.
832832

833833
If it is acceptable to only alter the behaviour of import statements
834834
without affecting other APIs that access the import system, then replacing
835-
the builtin :func:`__import__` function may be sufficient. This technique
836-
may also be employed at the module level to only alter the behaviour of
837-
import statements within that module.
835+
the builtin :func:`__import__` function may be sufficient.
838836

839837
To selectively prevent the import of some modules from a hook early on the
840838
meta path (rather than disabling the standard import system entirely),

0 commit comments

Comments
 (0)