File tree 2 files changed +3
-7
lines changed
2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -986,7 +986,7 @@ def test_options(self):
986
986
self .assertEqual (0 , ctx .options & ~ ssl .OP_NO_SSLv3 )
987
987
988
988
# invalid options
989
- with self .assertRaises (OverflowError ):
989
+ with self .assertRaises (ValueError ):
990
990
ctx .options = - 1
991
991
with self .assertRaises (OverflowError ):
992
992
ctx .options = 2 ** 100
Original file line number Diff line number Diff line change 27
27
28
28
#include "Python.h"
29
29
#include "pycore_fileutils.h" // _PyIsSelectable_fd()
30
+ #include "pycore_long.h" // _PyLong_UnsignedLongLong_Converter()
30
31
#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
31
32
#include "pycore_time.h" // _PyDeadline_Init()
32
33
@@ -3812,19 +3813,14 @@ static int
3812
3813
_ssl__SSLContext_options_set_impl (PySSLContext * self , PyObject * value )
3813
3814
/*[clinic end generated code: output=92ca34731ece5dbb input=2b94bf789e9ae5dd]*/
3814
3815
{
3815
- PyObject * new_opts_obj ;
3816
3816
unsigned long long new_opts_arg ;
3817
3817
uint64_t new_opts , opts , clear , set ;
3818
3818
uint64_t opt_no = (
3819
3819
SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 |
3820
3820
SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3
3821
3821
);
3822
3822
3823
- if (!PyArg_Parse (value , "O!" , & PyLong_Type , & new_opts_obj )) {
3824
- return -1 ;
3825
- }
3826
- new_opts_arg = PyLong_AsUnsignedLongLong (new_opts_obj );
3827
- if (new_opts_arg == (unsigned long long )-1 && PyErr_Occurred ()) {
3823
+ if (!PyArg_Parse (value , "O&" , _PyLong_UnsignedLongLong_Converter , & new_opts_arg )) {
3828
3824
return -1 ;
3829
3825
}
3830
3826
Py_BUILD_ASSERT (sizeof (new_opts ) >= sizeof (new_opts_arg ));
You can’t perform that action at this time.
0 commit comments