summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorYurii Karabas <1998uriyyo@gmail.com>2021-07-23 14:28:05 (GMT)
committerGitHub <noreply@github.com>2021-07-23 14:28:05 (GMT)
commit8f42106b5c362495f72c6ca2fa3884538e4023db (patch)
tree71f63012373fcd4092dc6f21ea4666dbbd5747d2 /Lib/test/test_typing.py
parent906fe47083bc9ab7ed2b70c99c1b0daad021f126 (diff)
downloadcpython-8f42106b5c362495f72c6ca2fa3884538e4023db.zip
cpython-8f42106b5c362495f72c6ca2fa3884538e4023db.tar.gz
cpython-8f42106b5c362495f72c6ca2fa3884538e4023db.tar.bz2
bpo-44353: Fix memory leak introduced by GH-27262 (GH-27305)
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 6f1d4f6..ebe6c8d 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3692,10 +3692,15 @@ class TestModules(TestCase):
class NewTypeTests:
+ def cleanup(self):
+ for f in self.module._cleanups:
+ f()
+
def setUp(self):
sys.modules['typing'] = self.module
def tearDown(self):
+ self.cleanup()
sys.modules['typing'] = typing
def test_basic(self):
@@ -3738,12 +3743,12 @@ class NewTypeTests:
self.assertEqual(repr(UserId), f'{__name__}.UserId')
-class NewTypePythonTests(BaseTestCase, NewTypeTests):
+class NewTypePythonTests(NewTypeTests, BaseTestCase):
module = py_typing
@skipUnless(c_typing, 'requires _typing')
-class NewTypeCTests(BaseTestCase, NewTypeTests):
+class NewTypeCTests(NewTypeTests, BaseTestCase):
module = c_typing