From eb776b626fafe9271cffb272d53c63d286ccb396 Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 26 Nov 2023 17:40:22 +0800 Subject: [PATCH 1/5] add find_module changes in 3.12 in sys.meta_path's document --- Doc/library/sys.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index bf9aaca2a696de..82eaf9897ee79a 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1261,6 +1261,11 @@ always available. This is still called as a fallback if a :data:`meta_path` entry doesn't have a :meth:`~importlib.abc.MetaPathFinder.find_spec` method. + .. versionchanged:: 3.12 + + :meth:`!find_module` have been removed and wouldn't been called as a + callback. + .. data:: modules This is a dictionary that maps module names to modules which have already been From d9a9faf5e477991c1843b8ff2c00fd69d9a4138a Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 26 Nov 2023 18:04:03 +0800 Subject: [PATCH 2/5] fix grammar issue --- Doc/library/sys.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 82eaf9897ee79a..dc178fdb883713 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1263,7 +1263,7 @@ always available. .. versionchanged:: 3.12 - :meth:`!find_module` have been removed and wouldn't been called as a + :meth:`!find_module` has been removed and wouldn't be called as a callback. .. data:: modules From e2a94ff75868997bb0609254d168a205c0c99431 Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 26 Nov 2023 21:05:44 +0800 Subject: [PATCH 3/5] fix typo --- Doc/library/sys.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index dc178fdb883713..15ec937b532f02 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1264,7 +1264,7 @@ always available. .. versionchanged:: 3.12 :meth:`!find_module` has been removed and wouldn't be called as a - callback. + fallback. .. data:: modules From e3092ea08846a3be365f7f94164cbeedb876cd6e Mon Sep 17 00:00:00 2001 From: AN Long Date: Thu, 30 Nov 2023 19:34:03 +0800 Subject: [PATCH 4/5] update document --- Doc/library/sys.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 15ec937b532f02..fd58048455c199 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1256,15 +1256,15 @@ always available. .. versionchanged:: 3.4 :term:`Module specs ` were introduced in Python 3.4, by - :pep:`451`. Earlier versions of Python looked for a method called - :meth:`!find_module`. - This is still called as a fallback if a :data:`meta_path` entry doesn't - have a :meth:`~importlib.abc.MetaPathFinder.find_spec` method. + :pep:`451`. .. versionchanged:: 3.12 - :meth:`!find_module` has been removed and wouldn't be called as a - fallback. + Earlier versions of Python looked for a method called + :meth:`!find_module` as fallback if a :data:`meta_path` entry doesn't + have a :meth:`~importlib.abc.MetaPathFinder.find_spec` method. + In this version, this behavior has been removed and the method wouldn't + be called as a fallback. .. data:: modules From 291e7d6fabbd4e0e6fa6028ea19e5c5ebd1c0276 Mon Sep 17 00:00:00 2001 From: AN Long Date: Thu, 11 Jan 2024 17:35:01 +0800 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Erlend E. Aasland --- Doc/library/sys.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index fd58048455c199..f599ac411c7ec6 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1260,11 +1260,9 @@ always available. .. versionchanged:: 3.12 - Earlier versions of Python looked for a method called - :meth:`!find_module` as fallback if a :data:`meta_path` entry doesn't - have a :meth:`~importlib.abc.MetaPathFinder.find_spec` method. - In this version, this behavior has been removed and the method wouldn't - be called as a fallback. + Removed the fallback that looked for a :meth:`!find_module` method + if a :data:`meta_path` entry didn't have a + :meth:`~importlib.abc.MetaPathFinder.find_spec` method. .. data:: modules