[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_embed.py b/Lib/test/test_embed.py
index f2cf4a6..479d712 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1541,9 +1541,7 @@ def test_methods(self):
     def test_disallow_instantiation(self):
         fd = self.get_stdout_fd()
         printer = self.create_printer(fd)
-        PyStdPrinter_Type = type(printer)
-        with self.assertRaises(TypeError):
-            PyStdPrinter_Type(fd)
+        support.check_disallow_instantiation(self, type(printer))
 
 
 if __name__ == "__main__":