You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python 3.7 "TCP echo server using streams" sample code does not work with uvloop. #221
python uvlopp_issue.py
python version: 3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0]
uvloop version: 0.12.0
Serving on ('127.0.0.1', 8888)
Traceback (most recent call last):
File "uvlopp_issue.py", line 36, in<module>asyncio.run(main())
File "/home/test/miniconda3/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
File "uvlopp_issue.py", line 27, in main
async with server:
AttributeError: __aexit__
I don't believe PR #224 fixes this issue. This issue is caused because the stock asyncio.base_events.Server in Python 3.7 was made into an asynchronous context manager. The entry method is simple:
The TCP echo server uses this manager in an async with server clause to ensure the server closes.
The uvloop replacement, uvloop.loop.Server, does not implement the methods for an asynchronous context manager in the master branch or in commit #8fac545a9351935eefc0c8d281bebd0dd2917d66 to address PR #224.
Activity
1st1 commentedon Jan 30, 2019
Thank you for reporting. This is basically a duplicate of #211.
jlaine commentedon Feb 16, 2019
This was fixed by PR #224
ahesford commentedon Mar 11, 2019
I don't believe PR #224 fixes this issue. This issue is caused because the stock asyncio.base_events.Server in Python 3.7 was made into an asynchronous context manager. The entry method is simple:
while the exit method closes the server:
The TCP echo server uses this manager in an
async with serverclause to ensure the server closes.The uvloop replacement, uvloop.loop.Server, does not implement the methods for an asynchronous context manager in the master branch or in commit #8fac545a9351935eefc0c8d281bebd0dd2917d66 to address PR #224.
Make Server an asynchronous context manager (fixes: MagicStack#221)
Make Server an asynchronous context manager (fixes: MagicStack#221)
Make Server an asynchronous context manager (fixes: MagicStack#221)
cemsbr commentedon Jun 21, 2019
The error persists. Won't the fix be merged?
Edit: more info:
jlaine commentedon Jun 22, 2019
The fix landed for v0.13.0, you can for instance give the release candidate a go: https://github.com/MagicStack/uvloop/releases/tag/v0.13.0rc1