Jose Cambronero added the comment: Woops, sorry about that, makes sense. Below an example (same idea as the files):
``` Python 3.6.2 (default, Sep 9 2017, 13:27:06) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> src = """ ... def f(x): return x ... [f(v) for v in [1,2,3]] ... """ >>> def comp(): ... exec(compile(src, filename='<str>', mode='exec')) ... >>> comp() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in comp File "<str>", line 3, in <module> File "<str>", line 3, in <listcomp> NameError: name 'f' is not defined >>> exec(compile(src, filename='<str>', mode='exec')) >>> ``` ---------- _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue31401> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
