@@ -149,10 +149,12 @@ static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
149149}
150150
151151#ifndef OPENSSL_NO_COMP
152+ /* LCOV_EXCL_START */
152153static int COMP_get_type (const COMP_METHOD * meth )
153154{
154155 return meth -> type ;
155156}
157+ /* LCOV_EXCL_END */
156158#endif
157159
158160static pem_password_cb * SSL_CTX_get_default_passwd_cb (SSL_CTX * ctx )
@@ -2408,8 +2410,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
24082410 Py_RETURN_NONE ;
24092411 }
24102412#endif
2411-
2412- pysess = PyObject_New (PySSLSession , & PySSLSession_Type );
2413+ pysess = PyObject_GC_New (PySSLSession , & PySSLSession_Type );
24132414 if (pysess == NULL ) {
24142415 SSL_SESSION_free (session );
24152416 return NULL ;
@@ -2419,6 +2420,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
24192420 pysess -> ctx = self -> ctx ;
24202421 Py_INCREF (pysess -> ctx );
24212422 pysess -> session = session ;
2423+ PyObject_GC_Track (pysess );
24222424 return (PyObject * )pysess ;
24232425}
24242426
@@ -4289,11 +4291,12 @@ static PyTypeObject PySSLMemoryBIO_Type = {
42894291static void
42904292PySSLSession_dealloc (PySSLSession * self )
42914293{
4294+ PyObject_GC_UnTrack (self );
42924295 Py_XDECREF (self -> ctx );
42934296 if (self -> session != NULL ) {
42944297 SSL_SESSION_free (self -> session );
42954298 }
4296- PyObject_Del (self );
4299+ PyObject_GC_Del (self );
42974300}
42984301
42994302static PyObject *
@@ -4455,7 +4458,7 @@ static PyTypeObject PySSLSession_Type = {
44554458 0 , /*tp_getattro*/
44564459 0 , /*tp_setattro*/
44574460 0 , /*tp_as_buffer*/
4458- Py_TPFLAGS_DEFAULT , /*tp_flags*/
4461+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC , /*tp_flags*/
44594462 0 , /*tp_doc*/
44604463 (traverseproc )PySSLSession_traverse , /*tp_traverse*/
44614464 (inquiry )PySSLSession_clear , /*tp_clear*/
@@ -4590,6 +4593,7 @@ _ssl_RAND_status_impl(PyObject *module)
45904593}
45914594
45924595#ifndef OPENSSL_NO_EGD
4596+ /* LCOV_EXCL_START */
45934597/*[clinic input]
45944598_ssl.RAND_egd
45954599 path: object(converter="PyUnicode_FSConverter")
@@ -4615,6 +4619,7 @@ _ssl_RAND_egd_impl(PyObject *module, PyObject *path)
46154619 }
46164620 return PyLong_FromLong (bytes );
46174621}
4622+ /* LCOV_EXCL_STOP */
46184623#endif /* OPENSSL_NO_EGD */
46194624
46204625
0 commit comments