python doesn't work with asyncio library

ggl329 ggl329@gmail.com
Sat Jan 23 21:09:57 GMT 2021


Hi Marco,

Thank you for maintaining python related packages.

I found that the updated python38 (3.8.6-2, 3.8.7-1) and python36 (3.6.12-2) don't
work with asyncio library. The "Hello World!" sample in python documentation fails.
Using python38 (3.8.3-1) or python36 (3.6.10-1), it succeeds.
This issue prevents ipython from starting up.
Could you check if this issue is reproducible on your environment?

=====
$ cat hello38.py
# hello38.py (https://docs.python.org/3.8/library/asyncio.html)
import asyncio
async def main():
     print('Hello ...')
     await asyncio.sleep(1)
     print('... World!')
asyncio.run(main())

$ python3.8 hello38.py
Traceback (most recent call last):
   File "hello38.py", line 7, in <module>
     asyncio.run(main())
   File "/usr/lib/python3.8/asyncio/runners.py", line 39, in run
     loop = events.new_event_loop()
   File "/usr/lib/python3.8/asyncio/events.py", line 758, in new_event_loop
     return get_event_loop_policy().new_event_loop()
   File "/usr/lib/python3.8/asyncio/events.py", line 656, in new_event_loop
     return self._loop_factory()
   File "/usr/lib/python3.8/asyncio/unix_events.py", line 54, in __init__
     super().__init__(selector)
   File "/usr/lib/python3.8/asyncio/selector_events.py", line 61, in __init__
     self._make_self_pipe()
   File "/usr/lib/python3.8/asyncio/selector_events.py", line 108, in _make_self_pipe
     self._ssock, self._csock = socket.socketpair()
   File "/usr/lib/python3.8/socket.py", line 571, in socketpair
     a, b = _socket.socketpair(family, type, proto)
SystemError: <built-in function socketpair> returned NULL without setting an error
Exception ignored in: <function BaseEventLoop.__del__ at 0x6fffffb49d30>
Traceback (most recent call last):
   File "/usr/lib/python3.8/asyncio/base_events.py", line 656, in __del__
     self.close()
   File "/usr/lib/python3.8/asyncio/unix_events.py", line 58, in close
     super().close()
   File "/usr/lib/python3.8/asyncio/selector_events.py", line 92, in close
     self._close_self_pipe()
   File "/usr/lib/python3.8/asyncio/selector_events.py", line 99, in _close_self_pipe
     self._remove_reader(self._ssock.fileno())
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_ssock'
sys:1: RuntimeWarning: coroutine 'main' was never awaited

=====
$ cat hello36.py
# hello36.py (https://docs.python.org/3.6/library/asyncio-task.html#example-hello-world-coroutine)
import asyncio
async def hello_world():
     print("Hello World!")
loop = asyncio.get_event_loop()
loop.run_until_complete(hello_world())
loop.close()

$ python3.6 hello36.py
Traceback (most recent call last):
   File "hello36.py", line 5, in <module>
     loop = asyncio.get_event_loop()
   File "/usr/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
     return get_event_loop_policy().get_event_loop()
   File "/usr/lib/python3.6/asyncio/events.py", line 599, in get_event_loop
     self.set_event_loop(self.new_event_loop())
   File "/usr/lib/python3.6/asyncio/events.py", line 617, in new_event_loop
     return self._loop_factory()
   File "/usr/lib/python3.6/asyncio/unix_events.py", line 56, in __init__
     super().__init__(selector)
   File "/usr/lib/python3.6/asyncio/selector_events.py", line 56, in __init__
     self._make_self_pipe()
   File "/usr/lib/python3.6/asyncio/selector_events.py", line 118, in _make_self_pipe
     self._ssock, self._csock = self._socketpair()
   File "/usr/lib/python3.6/asyncio/unix_events.py", line 60, in _socketpair
     return socket.socketpair()
   File "/usr/lib/python3.6/socket.py", line 488, in socketpair
     a, b = _socket.socketpair(family, type, proto)
SystemError: <built-in function socketpair> returned NULL without setting an error
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=False debug=False>>
Traceback (most recent call last):
   File "/usr/lib/python3.6/asyncio/base_events.py", line 533, in __del__
     self.close()
   File "/usr/lib/python3.6/asyncio/unix_events.py", line 63, in close
     super().close()
   File "/usr/lib/python3.6/asyncio/selector_events.py", line 99, in close
     self._close_self_pipe()
   File "/usr/lib/python3.6/asyncio/selector_events.py", line 109, in _close_self_pipe
     self._remove_reader(self._ssock.fileno())
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_ssock'


-- 
   ggl329


More information about the Cygwin mailing list