1# test the __globals__ attribute of a function
2
3
4def foo():
5    pass
6
7
8if not hasattr(foo, "__globals__"):
9    print("SKIP")
10    raise SystemExit
11
12print(type(foo.__globals__))
13print(foo.__globals__ is globals())
14
15foo.__globals__["bar"] = 123
16print(bar)
17
18try:
19    foo.__globals__ = None
20except AttributeError:
21    print("AttributeError")
22