@@ -355,6 +355,8 @@ typedef struct {
355355 PySSLContext * ctx ;
356356} PySSLSession ;
357357
358+ #define PySSLSession_CAST (op ) ((PySSLSession *)(op))
359+
358360static inline _PySSLError _PySSL_errno (int failed , const SSL * ssl , int retcode )
359361{
360362 _PySSLError err = { 0 };
@@ -5509,8 +5511,9 @@ static PyType_Spec PySSLMemoryBIO_spec = {
55095511 */
55105512
55115513static void
5512- PySSLSession_dealloc (PySSLSession * self )
5514+ PySSLSession_dealloc (PyObject * op )
55135515{
5516+ PySSLSession * self = PySSLSession_CAST (op );
55145517 PyTypeObject * tp = Py_TYPE (self );
55155518 /* bpo-31095: UnTrack is needed before calling any callbacks */
55165519 PyObject_GC_UnTrack (self );
@@ -5531,7 +5534,8 @@ PySSLSession_richcompare(PyObject *left, PyObject *right, int op)
55315534 }
55325535
55335536 int result ;
5534- PyTypeObject * sesstype = ((PySSLSession * )left )-> ctx -> state -> PySSLSession_Type ;
5537+ _sslmodulestate * state = get_state_obj (left );
5538+ PyTypeObject * sesstype = state -> PySSLSession_Type ;
55355539
55365540 if (!Py_IS_TYPE (left , sesstype ) || !Py_IS_TYPE (right , sesstype )) {
55375541 Py_RETURN_NOTIMPLEMENTED ;
@@ -5581,16 +5585,18 @@ PySSLSession_richcompare(PyObject *left, PyObject *right, int op)
55815585}
55825586
55835587static int
5584- PySSLSession_traverse (PySSLSession * self , visitproc visit , void * arg )
5588+ PySSLSession_traverse (PyObject * op , visitproc visit , void * arg )
55855589{
5590+ PySSLSession * self = PySSLSession_CAST (op );
55865591 Py_VISIT (self -> ctx );
55875592 Py_VISIT (Py_TYPE (self ));
55885593 return 0 ;
55895594}
55905595
55915596static int
5592- PySSLSession_clear (PySSLSession * self )
5597+ PySSLSession_clear (PyObject * op )
55935598{
5599+ PySSLSession * self = PySSLSession_CAST (op );
55945600 Py_CLEAR (self -> ctx );
55955601 return 0 ;
55965602}
0 commit comments