[New-bugs-announce] [issue40438] Python 3.9 eval on list comprehension sometimes returns coroutines

Jonathan Crall report at bugs.python.org
Wed Apr 29 11:02:05 EDT 2020


New submission from Jonathan Crall <erotemic at gmail.com>:

I first noticed this when testing xdoctest on Python 3.9, and then again when using IPython.

I was finally able to generate a minimal working example in Python itself. The following code:

python -c "print(eval(compile('[i for i in range(3)]', mode='eval', filename='foo', flags=221184)))"

produces 

[0, 1, 2]
 
in Python <= 3.8, but in 3.9 it produces: 

<coroutine object <module> at 0x7fa336d40ec0>
<string>:1: RuntimeWarning: coroutine '<module>' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback


Is this an intended change? I can't find any notes in the CHANGELOG that seem to correspond to it.

----------
components: Interpreter Core
messages: 367651
nosy: Jonathan Crall
priority: normal
severity: normal
status: open
title: Python 3.9 eval on list comprehension sometimes returns coroutines
versions: Python 3.9

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


More information about the New-bugs-announce mailing list