gh-102192: remove redundant exception fields from ssl module socket (#102466)

This commit is contained in:
Irit Katriel 2023-03-16 16:41:10 +00:00 committed by GitHub
parent 61d6c110d6
commit e108af6eca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 23 deletions

View file

@ -74,7 +74,7 @@ _PySSL_msg_callback(int write_p, int version, int content_type,
buf, len
);
if (res == NULL) {
PyErr_Fetch(&ssl_obj->exc_type, &ssl_obj->exc_value, &ssl_obj->exc_tb);
ssl_obj->exc = PyErr_GetRaisedException();
} else {
Py_DECREF(res);
}
@ -138,8 +138,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
lock = PyThread_allocate_lock();
if (lock == NULL) {
PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock");
PyErr_Fetch(&ssl_obj->exc_type, &ssl_obj->exc_value,
&ssl_obj->exc_tb);
ssl_obj->exc = PyErr_GetRaisedException();
return;
}
}
@ -156,7 +155,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
errno = e;
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError,
ssl_obj->ctx->keylog_filename);
PyErr_Fetch(&ssl_obj->exc_type, &ssl_obj->exc_value, &ssl_obj->exc_tb);
ssl_obj->exc = PyErr_GetRaisedException();
}
PyGILState_Release(threadstate);
}