Jim DeLaHunt <[email protected]> added the comment:
This is what I observe when I run my original program with Python 3.7.0. Notice
that the Task object instantiation fails with a clear error message:
% python -c 'import sys; print(sys.version)'
3.7.0 (default, Jun 28 2018, 06:01:52)
[Clang 8.0.0 (clang-800.0.42.1)]
% python bug_task_repr_1.py
type(ag()) is <class 'async_generator'>
asyncio.iscoroutine(ag)? False
repr(ag()) is <async_generator object ag at 0x1081a7730>
Traceback (most recent call last):
File "bug_task_repr_1.py", line 42, in <module>
task = asyncio.get_event_loop().create_task(ag())
File
"/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py",
line 386, in create_task
task = tasks.Task(coro, loop=self)
TypeError: a coroutine was expected, got <async_generator object ag at
0x1087cac80>
Also, the unit test example fails due to asyncio.test_utils no longer being
present in Python 3.7.0.
I am comfortable with a workaround of upgrading to 3.7.0 or later for anyone
who encounters this problem.
I file this bug report mostly to let people who encounter this problem find
this report in web searches, to help them understand the cause, and to see the
workaround (patching Task._repr_info) if upgrading to 3.7 is not feasible.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com