Skip to content

Commit 69d8fe5

Browse files
authored
pythongh-126548: Add a thread-unsafety warning for importlib.reload() (pythonGH-136704)
1 parent dcd27aa commit 69d8fe5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/importlib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ Functions
206206
:exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
207207
a :class:`~importlib.machinery.ModuleSpec`.
208208

209+
.. warning::
210+
This function is not thread-safe. Calling it from multiple threads can result
211+
in unexpected behavior. It's recommended to use the :class:`threading.Lock`
212+
or other synchronization primitives for thread-safe module reloading.
209213

210214
:mod:`importlib.abc` -- Abstract base classes related to import
211215
---------------------------------------------------------------

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy