]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-94101 Disallow instantiation of SSLSession objects (GH-94102)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 22 Jun 2022 10:50:03 +0000 (03:50 -0700)
committerGitHub <noreply@github.com>
Wed, 22 Jun 2022 10:50:03 +0000 (03:50 -0700)
Fixes GH-94101

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

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
Misc/NEWS.d/next/Library/2022-06-22-11-16-11.gh-issue-94101.V9vDG8.rst [new file with mode: 0644]
Modules/_ssl.c

diff --git a/Misc/NEWS.d/next/Library/2022-06-22-11-16-11.gh-issue-94101.V9vDG8.rst b/Misc/NEWS.d/next/Library/2022-06-22-11-16-11.gh-issue-94101.V9vDG8.rst
new file mode 100644 (file)
index 0000000..bcef0ca
--- /dev/null
@@ -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.
index af2520432a64e7accec2f318347958c18af945fd..c8500c57aee757d08e06bbaabb83ff8f7ee27644 100644 (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,
 };