[issue39562] Asynchronous comprehensions don't work in asyncio REPL

Batuhan Taskaya report at bugs.python.org
Mon Apr 20 11:13:30 EDT 2020


Batuhan Taskaya <batuhanosmantaskaya at gmail.com> added the comment:

> Is there an update of this *release blocker* issue? Should we revert the commit 9052f7a41b90f2d34011c8da68f9a4facebc8a97?

I dont think we can gain much by reverting 9052f7a41b90f2d34011c8da68f9a4facebc8a97 because it doesn't introduce a new issue, it just adds "another" path to notice it. 

Test:
>>> await __import__('asyncio').sleep(1)

Expected (and the behavior of 3.6):

(.venv) [  6:09PM ]  [ isidentical at threeheadedgiant:~ ]
 $ python3.6 z.py       
**********************************************************************
File "doctest.txt", line 4, in doctest.txt
Failed example:
    await __import__('asyncio').sleep(1)
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.6/doctest.py", line 1330, in __run
        compileflags, 1), test.globs)
      File "<doctest doctest.txt[0]>", line 1
        await __import__('asyncio').sleep(1)
                       ^
    SyntaxError: invalid syntax
**********************************************************************
1 items had failures:
   1 of   1 in doctest.txt
***Test Failed*** 1 failures.
result: TestResults(failed=1, attempted=1

Current master (+ reverted GH 18968):
(.venv) [  6:09PM ]  [ isidentical at threeheadedgiant:~ ]
 $ ./cpython/python z.py
/home/isidentical/cpython/Lib/doctest.py:1336: RuntimeWarning: coroutine '<module>' was never awaited
  exec(compile(example.source, filename, "single",
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
result: TestResults(failed=0, attempted=1)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39562>
_______________________________________


More information about the Python-bugs-list mailing list