Skip to content

Commit 9d27502

Browse files
committed
Update reload documentation
1 parent a64ccd6 commit 9d27502

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/library/importlib.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ Functions
210210
:exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
211211
a :class:`~importlib.machinery.ModuleSpec`.
212212

213+
.. versionchanged:: 3.14
214+
If *module* is a lazy module that has not yet been materialized (i.e.,
215+
loaded via :class:`importlib.util.LazyLoader` and not yet accessed),
216+
calling :func:`reload` is a no-op and returns the module unchanged.
217+
This prevents the reload from unintentionally triggering the lazy load.
218+
213219
.. warning::
214220
This function is not thread-safe. Calling it from multiple threads can result
215221
in unexpected behavior. It's recommended to use the :class:`threading.Lock`

0 commit comments

Comments
 (0)