servername_bytes = PyBytes_FromString(servername);
if (servername_bytes == NULL) {
- PyErr_WriteUnraisable((PyObject *) sslctx);
+ PyErr_FormatUnraisable("Exception ignored "
+ "in ssl servername callback");
goto error;
}
/* server_hostname was encoded to an A-label by our caller; put it
*/
servername_str = PyUnicode_FromEncodedObject(servername_bytes, "ascii", NULL);
if (servername_str == NULL) {
- PyErr_WriteUnraisable(servername_bytes);
+ PyErr_FormatUnraisable("Exception ignored "
+ "in ssl servername callback "
+ "while decoding name %R",
+ servername_bytes);
Py_DECREF(servername_bytes);
goto error;
}
Py_DECREF(ssl_socket);
if (result == NULL) {
- PyErr_WriteUnraisable(sslctx->set_sni_cb);
+ PyErr_FormatUnraisable("Exception ignored "
+ "in ssl servername callback "
+ "while calling set SNI callback %R",
+ sslctx->set_sni_cb);
*al = SSL_AD_HANDSHAKE_FAILURE;
ret = SSL_TLSEXT_ERR_ALERT_FATAL;
}
} else {
*al = (int) PyLong_AsLong(result);
if (PyErr_Occurred()) {
- PyErr_WriteUnraisable(result);
+ PyErr_FormatUnraisable("Exception ignored "
+ "in ssl servername callback "
+ "while calling set SNI callback "
+ "(result=%R)",
+ result);
*al = SSL_AD_INTERNAL_ERROR;
}
ret = SSL_TLSEXT_ERR_ALERT_FATAL;
error:
if (PyErr_Occurred()) {
- PyErr_WriteUnraisable(callback);
+ PyErr_FormatUnraisable("Exception ignored in ssl PSK client callback "
+ "while calling callback %R", callback);
}
PyGILState_Release(gstate);
return 0;
error:
if (PyErr_Occurred()) {
- PyErr_WriteUnraisable(callback);
+ PyErr_FormatUnraisable("Exception ignored in ssl PSK server callback "
+ "while calling callback %R", callback);
}
PyGILState_Release(gstate);
return 0;
goto err;
}
- if (PyDict_SetItem(self->localdicts, tstate->threading_local_key, ldict) <
- 0) {
+ if (PyDict_SetItem(self->localdicts, tstate->threading_local_key,
+ ldict) < 0)
+ {
goto err;
}
wr = create_sentinel_wr(self);
if (wr == NULL) {
PyObject *exc = PyErr_GetRaisedException();
- if (PyDict_DelItem(self->localdicts, tstate->threading_local_key) <
- 0) {
- PyErr_WriteUnraisable((PyObject *)self);
+ if (PyDict_DelItem(self->localdicts,
+ tstate->threading_local_key) < 0)
+ {
+ PyErr_FormatUnraisable("Exception ignored while deleting "
+ "thread local of %R", self);
}
PyErr_SetRaisedException(exc);
goto err;
if (PySet_Add(self->thread_watchdogs, wr) < 0) {
PyObject *exc = PyErr_GetRaisedException();
- if (PyDict_DelItem(self->localdicts, tstate->threading_local_key) <
- 0) {
- PyErr_WriteUnraisable((PyObject *)self);
+ if (PyDict_DelItem(self->localdicts,
+ tstate->threading_local_key) < 0)
+ {
+ PyErr_FormatUnraisable("Exception ignored while deleting "
+ "thread local of %R", self);
}
PyErr_SetRaisedException(exc);
goto err;
we create a new one the next time we do an attr
access */
PyObject *exc = PyErr_GetRaisedException();
- if (PyDict_DelItem(self->localdicts, tstate->threading_local_key) <
- 0) {
- PyErr_WriteUnraisable((PyObject *)self);
- PyErr_Clear();
+ if (PyDict_DelItem(self->localdicts,
+ tstate->threading_local_key) < 0)
+ {
+ PyErr_FormatUnraisable("Exception ignored while deleting "
+ "thread local of %R", self);
+ assert(!PyErr_Occurred());
}
if (PySet_Discard(self->thread_watchdogs, wr) < 0) {
- PyErr_WriteUnraisable((PyObject *)self);
+ PyErr_FormatUnraisable("Exception ignored while discarding "
+ "thread watchdog of %R", self);
}
PyErr_SetRaisedException(exc);
Py_DECREF(ldict);
if (self->localdicts != NULL) {
PyObject *key = PyTuple_GetItem(locals_and_key, 1);
if (PyDict_Pop(self->localdicts, key, NULL) < 0) {
- PyErr_WriteUnraisable((PyObject*)self);
+ PyErr_FormatUnraisable("Exception ignored while clearing "
+ "thread local %R", (PyObject *)self);
}
}
if (self->thread_watchdogs != NULL) {
if (PySet_Discard(self->thread_watchdogs, dummyweakref) < 0) {
- PyErr_WriteUnraisable((PyObject *)self);
+ PyErr_FormatUnraisable("Exception ignored while clearing "
+ "thread local %R", (PyObject *)self);
}
}
// Wait for the thread to finish. If we're interrupted, such
// as by a ctrl-c we print the error and exit early.
if (ThreadHandle_join(handle, -1) < 0) {
- PyErr_WriteUnraisable(NULL);
+ PyErr_FormatUnraisable("Exception ignored while joining a thread "
+ "in _thread._shutdown()");
ThreadHandle_decref(handle);
Py_RETURN_NONE;
}