@@ -314,9 +314,7 @@ typedef struct {
314314 * store exception information on the socket. The handshake, read, write,
315315 * and shutdown methods check for chained exceptions.
316316 */
317- PyObject * exc_type ;
318- PyObject * exc_value ;
319- PyObject * exc_tb ;
317+ PyObject * exc ;
320318} PySSLSocket ;
321319
322320typedef struct {
@@ -560,13 +558,10 @@ fill_and_set_sslerror(_sslmodulestate *state,
560558
561559static int
562560PySSL_ChainExceptions (PySSLSocket * sslsock ) {
563- if (sslsock -> exc_type == NULL )
561+ if (sslsock -> exc == NULL )
564562 return 0 ;
565563
566- _PyErr_ChainExceptions (sslsock -> exc_type , sslsock -> exc_value , sslsock -> exc_tb );
567- sslsock -> exc_type = NULL ;
568- sslsock -> exc_value = NULL ;
569- sslsock -> exc_tb = NULL ;
564+ _PyErr_ChainExceptions1 (sslsock -> exc );
570565 return -1 ;
571566}
572567
@@ -803,9 +798,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
803798 self -> owner = NULL ;
804799 self -> server_hostname = NULL ;
805800 self -> err = err ;
806- self -> exc_type = NULL ;
807- self -> exc_value = NULL ;
808- self -> exc_tb = NULL ;
801+ self -> exc = NULL ;
809802
810803 /* Make sure the SSL error state is initialized */
811804 ERR_clear_error ();
@@ -2175,19 +2168,15 @@ Passed as \"self\" in servername callback.");
21752168static int
21762169PySSL_traverse (PySSLSocket * self , visitproc visit , void * arg )
21772170{
2178- Py_VISIT (self -> exc_type );
2179- Py_VISIT (self -> exc_value );
2180- Py_VISIT (self -> exc_tb );
2171+ Py_VISIT (self -> exc );
21812172 Py_VISIT (Py_TYPE (self ));
21822173 return 0 ;
21832174}
21842175
21852176static int
21862177PySSL_clear (PySSLSocket * self )
21872178{
2188- Py_CLEAR (self -> exc_type );
2189- Py_CLEAR (self -> exc_value );
2190- Py_CLEAR (self -> exc_tb );
2179+ Py_CLEAR (self -> exc );
21912180 return 0 ;
21922181}
21932182
@@ -2532,7 +2521,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
25322521 PySSL_SetError (self , retval , __FILE__ , __LINE__ );
25332522 goto error ;
25342523 }
2535- if (self -> exc_type != NULL )
2524+ if (self -> exc != NULL )
25362525 goto error ;
25372526
25382527done :
@@ -2658,7 +2647,7 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self)
26582647 PySSL_SetError (self , ret , __FILE__ , __LINE__ );
26592648 return NULL ;
26602649 }
2661- if (self -> exc_type != NULL )
2650+ if (self -> exc != NULL )
26622651 goto error ;
26632652 if (sock )
26642653 /* It's already INCREF'ed */
0 commit comments