[Python-checkins] gh-94101 Disallow instantiation of SSLSession objects (GH-94102)

miss-islington webhook-mailer at python.org
Wed Jun 22 06:10:34 EDT 2022


https://github.com/python/cpython/commit/dc8e1d0390e16e90b2f74f6bd6417324a357bc23
commit: dc8e1d0390e16e90b2f74f6bd6417324a357bc23
branch: main
author: chgnrdv <52372310+chgnrdv at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-06-22T03:10:22-07:00
summary:

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



Fixes #94101

Automerge-Triggered-By: GH:tiran

files:
A Misc/NEWS.d/next/Library/2022-06-22-11-16-11.gh-issue-94101.V9vDG8.rst
M 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
index 0000000000000..bcef0ca07470a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-06-22-11-16-11.gh-issue-94101.V9vDG8.rst
@@ -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.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index e67ab42050b26..08596577086ac 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -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,
 };
 



More information about the Python-checkins mailing list