summaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-18 02:48:47 -0700
committerGitHub <noreply@github.com>2019-05-18 02:48:47 -0700
commit561c63cd70727e92179018188a9a9c33587fbd3f (patch)
tree536aacd87bcd796fe185337f907a8bfad3e811a4 /Doc
parent740a7cde9c0af5a237a7f6525b38d65a83f4fbf1 (diff)
downloadcpython-git-561c63cd70727e92179018188a9a9c33587fbd3f.tar.gz
Fixed typo (GH-11522)
Given example does not run, loop variable is missing. Secondly, this is bad example how to handle shutdown signal, because it would cause `RuntimeError: Event loop stopped before Future completed.` Perhaps it would be better to cancel all tasks instead of closing loop directly? Did not create issue, because question is quite simple. (cherry picked from commit ceb842e155f5fa0109fa88d52da3d1f5e73490ad) Co-authored-by: Alexander Vasin <hi@alvass.in>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/asyncio-eventloop.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index b9a8b8941a..7e1d571ef5 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -1605,7 +1605,7 @@ using the :meth:`loop.add_signal_handler` method::
import os
import signal
- def ask_exit(signame):
+ def ask_exit(signame, loop):
print("got signal %s: exit" % signame)
loop.stop()
@@ -1615,7 +1615,7 @@ using the :meth:`loop.add_signal_handler` method::
for signame in {'SIGINT', 'SIGTERM'}:
loop.add_signal_handler(
getattr(signal, signame),
- functools.partial(ask_exit, signame))
+ functools.partial(ask_exit, signame, loop))
await asyncio.sleep(3600)