bpo-43916: Remove _disabled_new() function (GH-25745)
posix and _hashlib use the new Py_TPFLAGS_DISALLOW_INSTANTIATION
flag on their heap types, rather than using a custom tp_new function
(_disabled_new).
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 9e9c874..1236aa7 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -905,11 +905,11 @@ def test_get_fips_mode(self):
def test_internal_types(self):
# internal types like _hashlib.HASH are not constructable
with self.assertRaisesRegex(
- TypeError, "cannot create 'HASH' instance"
+ TypeError, "cannot create '_hashlib.HASH' instance"
):
HASH()
with self.assertRaisesRegex(
- TypeError, "cannot create 'HASHXOF' instance"
+ TypeError, "cannot create '_hashlib.HASHXOF' instance"
):
HASHXOF()
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index adf52ad..22d74e9 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -440,7 +440,7 @@ def test_withmodule(self):
def test_internal_types(self):
# internal types like _hashlib.C_HMAC are not constructable
with self.assertRaisesRegex(
- TypeError, "cannot create 'HMAC' instance"
+ TypeError, "cannot create '_hashlib.HMAC' instance"
):
C_HMAC()