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

Fixes GH-94101

Automerge-Triggered-By: GH:tiran
(cherry picked from commit dc8e1d0390)

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-06-22 03:52:35 -07:00 committed by GitHub
parent c1bfff4f6b
commit 58d6a86bad
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,
};