diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2018-02-03 04:49:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-03 04:49:49 (GMT) |
commit | 4e9da0d163731caa79811c723c703ee416c31826 (patch) | |
tree | fa71d5f25341b13bcb446a929a3d46d864b51360 /Lib/test/test__xxsubinterpreters.py | |
parent | 2f79c014931cbb23b08a7d16c534a3cc9607ae14 (diff) | |
download | cpython-4e9da0d163731caa79811c723c703ee416c31826.zip cpython-4e9da0d163731caa79811c723c703ee416c31826.tar.gz cpython-4e9da0d163731caa79811c723c703ee416c31826.tar.bz2 |
bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (#5507)
Diffstat (limited to 'Lib/test/test__xxsubinterpreters.py')
-rw-r--r-- | Lib/test/test__xxsubinterpreters.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/test/test__xxsubinterpreters.py b/Lib/test/test__xxsubinterpreters.py index 2b17044..8d72ca2 100644 --- a/Lib/test/test__xxsubinterpreters.py +++ b/Lib/test/test__xxsubinterpreters.py @@ -362,13 +362,15 @@ class DestroyTests(TestBase): def test_from_current(self): main, = interpreters.list_all() id = interpreters.create() - script = dedent(""" + script = dedent(f""" import _xxsubinterpreters as _interpreters - _interpreters.destroy({}) - """).format(id) + try: + _interpreters.destroy({id}) + except RuntimeError: + pass + """) - with self.assertRaises(RuntimeError): - interpreters.run_string(id, script) + interpreters.run_string(id, script) self.assertEqual(set(interpreters.list_all()), {main, id}) def test_from_sibling(self): @@ -761,12 +763,12 @@ class ChannelIDTests(TestBase): self.assertEqual(int(cid), 10) def test_bad_id(self): - ids = [-1, 2**64, "spam"] - for cid in ids: + for cid in [-1, 'spam']: with self.subTest(cid): with self.assertRaises(ValueError): interpreters._channel_id(cid) - + with self.assertRaises(OverflowError): + interpreters._channel_id(2**64) with self.assertRaises(TypeError): interpreters._channel_id(object()) |