summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_enum.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r--Lib/test/test_enum.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 572e873..99fc850 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -1858,6 +1858,15 @@ class TestEnum(unittest.TestCase):
REVERT_ALL = "REVERT_ALL"
RETRY = "RETRY"
+ def test_empty_globals(self):
+ # bpo-35717: sys._getframe(2).f_globals['__name__'] fails with KeyError
+ # when using compile and exec because f_globals is empty
+ 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)
+
class TestOrder(unittest.TestCase):