This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients alex, christian.heimes, dstufft, janssen, njs, vstinner
Date 2019-06-17.21:29:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560806968.91.0.381503682557.issue37120@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2019-06-17 21:29:28vstinnersetrecipients: + vstinner, janssen, christian.heimes, alex, njs, dstufft
2019-06-17 21:29:28vstinnersetmessageid: <1560806968.91.0.381503682557.issue37120@roundup.psfhosted.org>
2019-06-17 21:29:28vstinnerlinkissue37120 messages
2019-06-17 21:29:28vstinnercreate