gh-126455: Disallow _ssl.SSLSocket instantiation (#126481)

Prevent creation of incomplete/invalid _ssl.SSLSocket objects when
created directly.
This commit is contained in:
Victor Stinner 2024-11-06 11:59:39 +01:00 committed by GitHub
parent 09d7083962
commit b1c4ffc205
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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