New submission from STINNER Victor <vstin...@redhat.com>:
sys._getframe(2) fails in the following example: code = "from enum import Enum; Enum('Animal', 'ANT BEE CAT DOG')" code = compile(code, "<string>", "exec") global_ns = {} local_ls = {} exec(code, global_ns, local_ls) Error with Python 3.7.2 (Fedora 29): Traceback (most recent call last): File "x.py", line 5, in <module> exec(code, global_ns, local_ls) File "<string>", line 1, in <module> File "/usr/lib64/python3.7/enum.py", line 311, in __call__ return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start) File "/usr/lib64/python3.7/enum.py", line 429, in _create_ module = sys._getframe(2).f_globals['__name__'] KeyError: '__name__' ---------- components: Library (Lib) messages: 333474 nosy: barry, eli.bendersky, ethan.furman, vstinner priority: normal severity: normal status: open title: enum.Enum error on sys._getframe(2) versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35717> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com