8000 gh-85299: Add note warning about entry point guard for asyncio example by slateny · Pull Request #93457 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-85299: Add note warning about entry point guard for asyncio example #93457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 16, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use rewording for multiprocessing
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
  • Loading branch information
slateny and CAM-Gerlach authored Oct 16, 2022
commit fd68a5ea4e9c53261c56002f2366a080f1fa7b30
8 changes: 4 additions & 4 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1209,10 +1209,10 @@ Executing code in thread or process pools
if __name__ == '__main__':
asyncio.run(main())

Note that on Windows and macOS, the entry point guard may be necessary as the
example would otherwise cause a :exc:`RuntimeError`. For more details, see the
`Safe importing of main module
<https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods>`_.
Note that the entry point guard (``if __name__ == '__main__'``)
is required for option 3 due to the peculiarities of :mod:`multiprocessing`,
which is used by :class:`~concurrent.futures.ProcessPoolExecutor.
See :ref:`Safe importing of main module <multiprocessing-safe-main-import>`.

This method returns a :class:`asyncio.Future` object.

Expand Down
0