File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed
Expand file tree Collapse file tree 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):
986986 self .assertEqual (0 , ctx .options & ~ ssl .OP_NO_SSLv3 )
987987
988988 # invalid options
989- with self .assertRaises (OverflowError ):
989+ with self .assertRaises (ValueError ):
990990 ctx .options = - 1
991991 with self .assertRaises (OverflowError ):
992992 ctx .options = 2 ** 100
Original file line number Diff line number Diff line change 2727
2828#include "Python.h"
2929#include "pycore_fileutils.h" // _PyIsSelectable_fd()
30+ #include "pycore_long.h" // _PyLong_UnsignedLongLong_Converter()
3031#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
3132#include "pycore_time.h" // _PyDeadline_Init()
3233
@@ -3812,19 +3813,14 @@ static int
38123813_ssl__SSLContext_options_set_impl (PySSLContext * self , PyObject * value )
38133814/*[clinic end generated code: output=92ca34731ece5dbb input=2b94bf789e9ae5dd]*/
38143815{
3815- PyObject * new_opts_obj ;
38163816 unsigned long long new_opts_arg ;
38173817 uint64_t new_opts , opts , clear , set ;
38183818 uint64_t opt_no = (
38193819 SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 |
38203820 SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3
38213821 );
38223822
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 )) {
38283824 return -1 ;
38293825 }
38303826 Py_BUILD_ASSERT (sizeof (new_opts ) >= sizeof (new_opts_arg ));
You can’t perform that action at this time.
0 commit comments