Author vstinner
Recipients barry, eli.bendersky, ethan.furman, vstinner
Date 2019-01-11.15:08:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547219293.78.0.972109062344.issue35717@roundup.psfhosted.org>
In-reply-to
Content
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__'
History
Date User Action Args
2019-01-11 15:08:17vstinnersetrecipients: + vstinner, barry, eli.bendersky, ethan.furman
2019-01-11 15:08:13vstinnersetmessageid: <1547219293.78.0.972109062344.issue35717@roundup.psfhosted.org>
2019-01-11 15:08:13vstinnerlinkissue35717 messages
2019-01-11 15:08:13vstinnercreate