summaryrefslogtreecommitdiffstats
path: root/Lib/test/final_a.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-07-31 21:14:08 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-07-31 21:14:08 (GMT)
commitdcedaf6e53fcba48aa8185d0dc27d832da2615aa (patch)
tree1dec81865462dd482c792e3790280a1c8393e18f /Lib/test/final_a.py
parentc27cd71cd71e5b3f464f6994e2a73f201eb430ca (diff)
downloadcpython-dcedaf6e53fcba48aa8185d0dc27d832da2615aa.zip
cpython-dcedaf6e53fcba48aa8185d0dc27d832da2615aa.tar.gz
cpython-dcedaf6e53fcba48aa8185d0dc27d832da2615aa.tar.bz2
Issue #18214: Improve finalization of Python modules to avoid setting their globals to None, in most cases.
Diffstat (limited to 'Lib/test/final_a.py')
-rw-r--r--Lib/test/final_a.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/final_a.py b/Lib/test/final_a.py
new file mode 100644
index 0000000..390ee88
--- /dev/null
+++ b/Lib/test/final_a.py
@@ -0,0 +1,19 @@
+"""
+Fodder for module finalization tests in test_module.
+"""
+
+import shutil
+import test.final_b
+
+x = 'a'
+
+class C:
+ def __del__(self):
+ # Inspect module globals and builtins
+ print("x =", x)
+ print("final_b.x =", test.final_b.x)
+ print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))
+ print("len =", getattr(len, '__name__', None))
+
+c = C()
+_underscored = C()