[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 b1c4ffc205)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2024-11-06 12:24:45 +01:00 committed by GitHub
parent 4f1584657f
commit 6a084b9d60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,
};