STINNER Victor <vstin...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue37120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to