@@ -312,6 +312,8 @@ typedef struct {
312312#endif
313313} PySSLContext ;
314314
315+ #define PySSLContext_CAST (op ) ((PySSLContext *)(op))
316+
315317typedef struct {
316318 int ssl ; /* last seen error from SSL */
317319 int c ; /* last seen error from libc */
@@ -3278,17 +3280,19 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
32783280}
32793281
32803282static int
3281- context_traverse (PySSLContext * self , visitproc visit , void * arg )
3283+ context_traverse (PyObject * op , visitproc visit , void * arg )
32823284{
3285+ PySSLContext * self = PySSLContext_CAST (op );
32833286 Py_VISIT (self -> set_sni_cb );
32843287 Py_VISIT (self -> msg_cb );
32853288 Py_VISIT (Py_TYPE (self ));
32863289 return 0 ;
32873290}
32883291
32893292static int
3290- context_clear (PySSLContext * self )
3293+ context_clear (PyObject * op )
32913294{
3295+ PySSLContext * self = PySSLContext_CAST (op );
32923296 Py_CLEAR (self -> set_sni_cb );
32933297 Py_CLEAR (self -> msg_cb );
32943298 Py_CLEAR (self -> keylog_filename );
@@ -3306,15 +3310,16 @@ context_clear(PySSLContext *self)
33063310}
33073311
33083312static void
3309- context_dealloc (PySSLContext * self )
3313+ context_dealloc (PyObject * op )
33103314{
3315+ PySSLContext * self = PySSLContext_CAST (op );
33113316 PyTypeObject * tp = Py_TYPE (self );
33123317 /* bpo-31095: UnTrack is needed before calling any callbacks */
33133318 PyObject_GC_UnTrack (self );
3314- context_clear (self );
3319+ ( void ) context_clear (op );
33153320 SSL_CTX_free (self -> ctx );
33163321 PyMem_FREE (self -> alpn_protocols );
3317- Py_TYPE ( self ) -> tp_free (self );
3322+ tp -> tp_free (self );
33183323 Py_DECREF (tp );
33193324}
33203325
@@ -3908,7 +3913,9 @@ _ssl__SSLContext_check_hostname_set_impl(PySSLContext *self, PyObject *value)
39083913}
39093914
39103915static PyObject *
3911- get_post_handshake_auth (PySSLContext * self , void * c ) {
3916+ get_post_handshake_auth (PyObject * op , void * Py_UNUSED (closure ))
3917+ {
3918+ PySSLContext * self = PySSLContext_CAST (op );
39123919#if defined(PySSL_HAVE_POST_HS_AUTH )
39133920 return PyBool_FromLong (self -> post_handshake_auth );
39143921#else
@@ -3918,7 +3925,9 @@ get_post_handshake_auth(PySSLContext *self, void *c) {
39183925
39193926#if defined(PySSL_HAVE_POST_HS_AUTH )
39203927static int
3921- set_post_handshake_auth (PySSLContext * self , PyObject * arg , void * c ) {
3928+ set_post_handshake_auth (PyObject * op , PyObject * arg , void * Py_UNUSED (closure ))
3929+ {
3930+ PySSLContext * self = PySSLContext_CAST (op );
39223931 if (arg == NULL ) {
39233932 PyErr_SetString (PyExc_AttributeError , "cannot delete attribute" );
39243933 return -1 ;
@@ -5197,18 +5206,18 @@ static PyGetSetDef context_getsetlist[] = {
51975206 _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF
51985207 _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF
51995208 _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF
5200- {"keylog_filename" , ( getter ) _PySSLContext_get_keylog_filename ,
5201- ( setter ) _PySSLContext_set_keylog_filename , NULL },
5202- {"_msg_callback" , ( getter ) _PySSLContext_get_msg_callback ,
5203- ( setter ) _PySSLContext_set_msg_callback , NULL },
5209+ {"keylog_filename" , _PySSLContext_get_keylog_filename ,
5210+ _PySSLContext_set_keylog_filename , NULL },
5211+ {"_msg_callback" , _PySSLContext_get_msg_callback ,
5212+ _PySSLContext_set_msg_callback , NULL },
52045213 _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF
52055214#if defined(TLS1_3_VERSION ) && !defined (OPENSSL_NO_TLS1_3 )
52065215 _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF
52075216#endif
52085217 _SSL__SSLCONTEXT_OPTIONS_GETSETDEF
5209- {"post_handshake_auth" , ( getter ) get_post_handshake_auth ,
5218+ {"post_handshake_auth" , get_post_handshake_auth ,
52105219#if defined(PySSL_HAVE_POST_HS_AUTH )
5211- ( setter ) set_post_handshake_auth ,
5220+ set_post_handshake_auth ,
52125221#else
52135222 NULL ,
52145223#endif
0 commit comments