summaryrefslogtreecommitdiff
path: root/tests/basics/fun_globals.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/fun_globals.py')
-rw-r--r--tests/basics/fun_globals.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/basics/fun_globals.py b/tests/basics/fun_globals.py
index 3f32e8bdb..69f8638e8 100644
--- a/tests/basics/fun_globals.py
+++ b/tests/basics/fun_globals.py
@@ -19,3 +19,18 @@ try:
foo.__globals__ = None
except AttributeError:
print("AttributeError")
+
+# test closures have the __globals__ attribute
+
+
+def outer():
+ x = 1
+
+ def inner():
+ return x
+
+ return inner
+
+
+print(outer.__globals__ is globals())
+print(outer().__globals__ is globals())