@@ -318,9 +318,7 @@ typedef struct {
318
318
* store exception information on the socket. The handshake, read, write,
319
319
* and shutdown methods check for chained exceptions.
320
320
*/
321
- PyObject * exc_type ;
322
- PyObject * exc_value ;
323
- PyObject * exc_tb ;
321
+ PyObject * exc ;
324
322
} PySSLSocket ;
325
323
326
324
typedef struct {
@@ -564,13 +562,11 @@ fill_and_set_sslerror(_sslmodulestate *state,
564
562
565
563
static int
566
564
PySSL_ChainExceptions (PySSLSocket * sslsock ) {
567
- if (sslsock -> exc_type == NULL )
565
+ if (sslsock -> exc == NULL )
568
566
return 0 ;
569
567
570
- _PyErr_ChainExceptions (sslsock -> exc_type , sslsock -> exc_value , sslsock -> exc_tb );
571
- sslsock -> exc_type = NULL ;
572
- sslsock -> exc_value = NULL ;
573
- sslsock -> exc_tb = NULL ;
568
+ _PyErr_ChainExceptions1 (sslsock -> exc );
569
+ sslsock -> exc = NULL ;
574
570
return -1 ;
575
571
}
576
572
@@ -807,9 +803,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
807
803
self -> owner = NULL ;
808
804
self -> server_hostname = NULL ;
809
805
self -> err = err ;
810
- self -> exc_type = NULL ;
811
- self -> exc_value = NULL ;
812
- self -> exc_tb = NULL ;
806
+ self -> exc = NULL ;
813
807
814
808
/* Make sure the SSL error state is initialized */
815
809
ERR_clear_error ();
@@ -2179,19 +2173,15 @@ Passed as \"self\" in servername callback.");
2179
2173
static int
2180
2174
PySSL_traverse (PySSLSocket * self , visitproc visit , void * arg )
2181
2175
{
2182
- Py_VISIT (self -> exc_type );
2183
- Py_VISIT (self -> exc_value );
2184
- Py_VISIT (self -> exc_tb );
2176
+ Py_VISIT (self -> exc );
2185
2177
Py_VISIT (Py_TYPE (self ));
2186
2178
return 0 ;
2187
2179
}
2188
2180
2189
2181
static int
2190
2182
PySSL_clear (PySSLSocket * self )
2191
2183
{
2192
- Py_CLEAR (self -> exc_type );
2193
- Py_CLEAR (self -> exc_value );
2194
- Py_CLEAR (self -> exc_tb );
2184
+ Py_CLEAR (self -> exc );
2195
2185
return 0 ;
2196
2186
}
2197
2187
@@ -2536,7 +2526,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
2536
2526
PySSL_SetError (self , retval , __FILE__ , __LINE__ );
2537
2527
goto error ;
2538
2528
}
2539
- if (self -> exc_type != NULL )
2529
+ if (self -> exc != NULL )
2540
2530
goto error ;
2541
2531
2542
2532
done :
@@ -2662,7 +2652,7 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self)
2662
2652
PySSL_SetError (self , ret , __FILE__ , __LINE__ );
2663
2653
return NULL ;
2664
2654
}
2665
- if (self -> exc_type != NULL )
2655
+ if (self -> exc != NULL )
2666
2656
goto error ;
2667
2657
if (sock )
2668
2658
/* It's already INCREF'ed */
0 commit comments