summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-30 11:08:24 (GMT)
committerPetr Viktorin <pviktori@redhat.com>2019-05-30 11:08:24 (GMT)
commit249b7d59d8038f9017fc95dc28a3ce3494aaf832 (patch)
treec7df4d0c071aa6dfda7086c87a6c5ecc176e1bc7 /Lib
parentc145f3bfbe80d498d40848450d4d33c14e2cf782 (diff)
downloadcpython-249b7d59d8038f9017fc95dc28a3ce3494aaf832.zip
cpython-249b7d59d8038f9017fc95dc28a3ce3494aaf832.tar.gz
cpython-249b7d59d8038f9017fc95dc28a3ce3494aaf832.tar.bz2
bpo-20602: Do not clear sys.flags and sys.float_info during shutdown (GH-8096)
There is no need to clear these immutable objects during shutdown.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_sys.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index c558d11..49f2722 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -822,6 +822,22 @@ class SysModuleTest(unittest.TestCase):
rc, stdout, stderr = assert_python_ok('-c', code)
self.assertEqual(stdout.rstrip(), b'True')
+ @test.support.requires_type_collecting
+ def test_issue20602(self):
+ # sys.flags and sys.float_info were wiped during shutdown.
+ code = """if 1:
+ import sys
+ class A:
+ def __del__(self, sys=sys):
+ print(sys.flags)
+ print(sys.float_info)
+ a = A()
+ """
+ rc, out, err = assert_python_ok('-c', code)
+ out = out.splitlines()
+ self.assertIn(b'sys.flags', out[0])
+ self.assertIn(b'sys.float_info', out[1])
+
@unittest.skipUnless(hasattr(sys, 'getandroidapilevel'),
'need sys.getandroidapilevel()')
def test_getandroidapilevel(self):