[issue37120] Provide knobs to disable session ticket generation on TLS 1.3

STINNER Victor report at bugs.python.org
Mon Jun 17 17:29:28 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

New changeset 78c7d527799dacca91b9ed67057cb996efe526b0 by Christian Heimes in branch 'master':
bpo-37120: Add SSLContext.num_tickets (GH-13719)
https://github.com/python/cpython/commit/78c7d527799dacca91b9ed67057cb996efe526b0


This change introduced this warning on Windows:

c:\vstinner\python\master\modules\_ssl.c(3624): warning C4267: 'function': conv 
ersion from 'size_t' to 'long', possible loss of data [C:\vstinner\python\maste 
r\PCbuild\_ssl.vcxproj]


SSL_CTX_get_num_tickets() return type is size_t. I suggest this change:


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 2331c58ad7..3ffb6380d3 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3621,7 +3621,7 @@ set_maximum_version(PySSLContext *self, PyObject *arg, void *c)
 static PyObject *
 get_num_tickets(PySSLContext *self, void *c)
 {
-    return PyLong_FromLong(SSL_CTX_get_num_tickets(self->ctx));
+    return PyLong_FromSize_t(SSL_CTX_get_num_tickets(self->ctx));
 }
 
 static int

----------
nosy: +vstinner

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37120>
_______________________________________


More information about the Python-bugs-list mailing list