https://github.com/python/cpython/commit/e6fd40ba1883040224128cbb30fa002827f18392
commit: e6fd40ba1883040224128cbb30fa002827f18392
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2024-11-06T11:21:21Z
summary:

[3.12] gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) (#126487)

gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481)

Prevent creation of incomplete/invalid _ssl.SSLSocket objects when
created directly.
(cherry picked from commit b1c4ffc20573befb4db66bbbdd569b9bd13bb127)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Modules/_ssl.c

diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 35e4ce7af50fc6..7a9f2c87239eca 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2900,7 +2900,7 @@ static PyType_Spec PySSLSocket_spec = {
     .name = "_ssl._SSLSocket",
     .basicsize = sizeof(PySSLSocket),
     .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
-              Py_TPFLAGS_HAVE_GC),
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DISALLOW_INSTANTIATION),
     .slots = PySSLSocket_slots,
 };
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to