Skip to content

Commit

Permalink
pythongh-94101 Disallow instantiation of SSLSession objects (pythonGH…
Browse files Browse the repository at this point in the history
…-94102)

Fixes pythonGH-94101

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

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
  • Loading branch information
chgnrdv authored and miss-islington committed Jun 22, 2022
1 parent e51a22b commit 333d91b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit 333d91b

Please sign in to comment.