Skip to content

Commit f16838e

Browse files
committed
resolve comments
1 parent 36774be commit f16838e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Modules/_ssl.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4016,15 +4016,11 @@ _ssl__SSLContext_verify_flags_set_impl(PySSLContext *self, PyObject *value)
40164016
static int
40174017
set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
40184018
{
4019-
long v;
4019+
int v;
40204020
int result;
40214021

4022-
if (!PyArg_Parse(arg, "l", &v))
4022+
if (!PyArg_Parse(arg, "i", &v))
40234023
return -1;
4024-
if (v > INT_MAX) {
4025-
PyErr_SetString(PyExc_OverflowError, "Option is too long");
4026-
return -1;
4027-
}
40284024

40294025
switch(self->protocol) {
40304026
case PY_SSL_VERSION_TLS_CLIENT: _Py_FALLTHROUGH;
@@ -4059,7 +4055,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
40594055
break;
40604056
default:
40614057
PyErr_Format(PyExc_ValueError,
4062-
"Unsupported TLS/SSL version 0x%lx", v);
4058+
"Unsupported TLS/SSL version 0x%x", (unsigned)v);
40634059
return -1;
40644060
}
40654061

@@ -4093,7 +4089,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
40934089
}
40944090
if (result == 0) {
40954091
PyErr_Format(PyExc_ValueError,
4096-
"Unsupported protocol version 0x%lx", v);
4092+
"Unsupported protocol version 0x%x", (unsigned)v);
40974093
return -1;
40984094
}
40994095
return 0;

0 commit comments

Comments
 (0)