Karthikeyan Singaravelan <[email protected]> added the comment:
Thanks for the report. This looks like a valid change to me as I can see from
the docstring it says it can be None but in the source code there is an
explicit check that if self._local._loop which is returned is None then raise a
RuntimeError. I would propose removing the docstring in the example.
# Docstring says can be None
./python.exe -m pydoc asyncio.events.BaseDefaultEventLoopPolicy.get_event_loop
| cat
Help on function get_event_loop in asyncio.events.BaseDefaultEventLoopPolicy:
asyncio.events.BaseDefaultEventLoopPolicy.get_event_loop = get_event_loop(self)
Get the event loop.
This may be None or an instance of EventLoop.
# RuntimeError is raised for None
./python.exe -m inspect asyncio.events:BaseDefaultEventLoopPolicy.get_event_loop
def get_event_loop(self):
"""Get the event loop.
This may be None or an instance of EventLoop.
"""
if (self._local._loop is None and
not self._local._set_called and
isinstance(threading.current_thread(), threading._MainThread)):
self.set_event_loop(self.new_event_loop())
if self._local._loop is None:
raise RuntimeError('There is no current event loop in thread %r.'
% threading.current_thread().name)
return self._local._loop
----------
versions: +Python 3.9 -Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34344>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com