Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,14 @@ Miscellaneous
For this to work, it must be called before the forkserver process has been
launched (before creating a :class:`Pool` or starting a :class:`Process`).

Only modules directly imported at top level by *module_names* are preloaded.
If a preloaded module lazily imports dependencies inside functions or methods
(for example, :meth:`datetime.datetime.strptime` importing ``_strptime`` on
its first invocation), those dependencies are not loaded into the forkserver
process and will instead be imported separately in each child process upon
first use. To inherit those as well, call such functions at module level
within a preloaded module.

The *on_error* parameter controls how :exc:`ImportError` exceptions during
module preloading are handled: ``"ignore"`` (default) silently ignores
failures, ``"warn"`` causes the forkserver subprocess to emit an
Expand Down
Loading