gh-94101 Disallow instantiation of SSLSession objects (GH-94102)

Fixes #94101

Automerge-Triggered-By: GH:tiran
This commit is contained in:
chgnrdv 2022-06-22 13:10:22 +03:00 committed by GitHub
parent fda4b2f063
commit dc8e1d0390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,3 @@
Manual instantiation of :class:`ssl.SSLSession` objects is no longer allowed
as it lead to misconfigured instances that crashed the interpreter when
attributes where accessed on them.

View File

@ -5067,7 +5067,8 @@ static PyType_Spec PySSLSession_spec = {
.name = "_ssl.SSLSession",
.basicsize = sizeof(PySSLSession),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_IMMUTABLETYPE),
Py_TPFLAGS_IMMUTABLETYPE |
Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = PySSLSession_slots,
};