From b1c4ffc20573befb4db66bbbdd569b9bd13bb127 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 6 Nov 2024 11:59:39 +0100 Subject: [PATCH] gh-126455: Disallow _ssl.SSLSocket instantiation (#126481) Prevent creation of incomplete/invalid _ssl.SSLSocket objects when created directly. --- Modules/_ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5223e21b5cd..b6b5ebf094c 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2979,7 +2979,7 @@ static PyType_Spec PySSLSocket_spec = { .name = "_ssl._SSLSocket", .basicsize = sizeof(PySSLSocket), .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | - Py_TPFLAGS_HAVE_GC), + Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DISALLOW_INSTANTIATION), .slots = PySSLSocket_slots, };