From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:24:45 +0000 (+0100) Subject: [3.13] gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) (#126486) X-Git-Tag: v3.13.1~157 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a084b9d60f7c6085a5f7ea28c83c6285451a8ea;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) (#126486) gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) Prevent creation of incomplete/invalid _ssl.SSLSocket objects when created directly. (cherry picked from commit b1c4ffc20573befb4db66bbbdd569b9bd13bb127) Co-authored-by: Victor Stinner --- diff --git a/Modules/_ssl.c b/Modules/_ssl.c index db4e9c48df57..8993a6ccecb2 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2921,7 +2921,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, };