[3.10] bpo-43988: Add test.support.check_disallow_instantiation() (GH-25757) (GH-26885)
(cherry picked from commit 4f725261c6cf23d259e8fdc205e12b76ef4d2d31, fbff5387c3e1f3904420fa5a27738c6c5881305b, and 8cec740820fc875117bfa7b6bdb10202ebeb8fd5)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Automerge-Triggered-By: GH:vstinner
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index b563797..f648a8b 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -124,8 +124,7 @@ def func(): pass
def test_disallow_instantiation(self):
# Ensure that the type disallows instantiation (bpo-43916)
lock = threading.Lock()
- tp = type(lock)
- self.assertRaises(TypeError, tp)
+ test.support.check_disallow_instantiation(self, type(lock))
# Create a bunch of threads, let each do some work, wait until all are
# done.