Skip to content

Commit 58d6a86

Browse files
gh-94101 Disallow instantiation of SSLSession objects (GH-94102)
Fixes GH-94101 Automerge-Triggered-By: GH:tiran (cherry picked from commit dc8e1d0) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
1 parent c1bfff4 commit 58d6a86

File tree

2 files changed

+5
-1
lines changed

2 files changed

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

Modules/_ssl.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -5067,7 +5067,8 @@ static PyType_Spec PySSLSession_spec = {
50675067
.name = "_ssl.SSLSession",
50685068
.basicsize = sizeof(PySSLSession),
50695069
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
5070-
Py_TPFLAGS_IMMUTABLETYPE),
5070+
Py_TPFLAGS_IMMUTABLETYPE |
5071+
Py_TPFLAGS_DISALLOW_INSTANTIATION),
50715072
.slots = PySSLSession_slots,
50725073
};
50735074

0 commit comments

Comments
 (0)