https://github.com/python/cpython/commit/79c03ac0015ccf1cbb759f870e2af9d68f60fe3a
commit: 79c03ac0015ccf1cbb759f870e2af9d68f60fe3a
branch: main
author: Thanos <[email protected]>
committer: hauntsaninja <[email protected]>
date: 2025-12-29T21:16:54-08:00
summary:

gh-69686: Remove untrue part of `__import__` replacement docs (#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/cpython#69686.

files:
M Doc/reference/import.rst

diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index f50d02a0ef03b9..83f0ee75e7aebd 100644
--- a/Doc/reference/import.rst
+++ b/Doc/reference/import.rst
@@ -832,9 +832,7 @@ entirely with a custom meta path hook.
 
 If it is acceptable to only alter the behaviour of import statements
 without affecting other APIs that access the import system, then replacing
-the builtin :func:`__import__` function may be sufficient. This technique
-may also be employed at the module level to only alter the behaviour of
-import statements within that module.
+the builtin :func:`__import__` function may be sufficient.
 
 To selectively prevent the import of some modules from a hook early on the
 meta path (rather than disabling the standard import system entirely),

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to