Visitar URL original
gh-85299: Add note warning about entry point guard for asyncio example by slateny · Pull Request #93457 · python/cpython · GitHub
Skip to content
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
Add entry guard, clarify note on platform
  • Loading branch information
slateny committed Oct 15, 2022
commit 16cb2552768b42060cf449dfa96dba5123fa4623
10 changes: 5 additions & 5 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1206,12 +1206,12 @@ Executing code in thread or process pools
pool, cpu_bound)
print('custom process pool', result)

asyncio.run(main())
if __name__ == '__main__':
asyncio.run(main())

Note that on macOS, an entry point guard may be needed as the example would
otherwise cause a :exc:`RuntimeError`. See the `Changed in version 3.8 note
<https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods>`_
and `Safe importing of main module
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>`_.

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