mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-129354: Use PyErr_FormatUnraisable() function (#129524)
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable(). Update test_sqlite3 tests. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
04264a286e
commit
218f205f20
4 changed files with 28 additions and 21 deletions
|
@ -497,7 +497,8 @@ connection_finalize(PyObject *self)
|
|||
if (PyErr_ResourceWarning(self, 1, "unclosed database in %R", self)) {
|
||||
/* Spurious errors can appear at shutdown */
|
||||
if (PyErr_ExceptionMatches(PyExc_Warning)) {
|
||||
PyErr_WriteUnraisable(self);
|
||||
PyErr_FormatUnraisable("Exception ignored while finalizing "
|
||||
"database connection %R", self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +507,8 @@ connection_finalize(PyObject *self)
|
|||
PyErr_Clear();
|
||||
}
|
||||
else {
|
||||
PyErr_WriteUnraisable((PyObject *)self);
|
||||
PyErr_FormatUnraisable("Exception ignored while closing database %R",
|
||||
self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -893,7 +895,8 @@ print_or_clear_traceback(callback_context *ctx)
|
|||
assert(ctx != NULL);
|
||||
assert(ctx->state != NULL);
|
||||
if (ctx->state->enable_callback_tracebacks) {
|
||||
PyErr_WriteUnraisable(ctx->callable);
|
||||
PyErr_FormatUnraisable("Exception ignored on sqlite3 callback %R",
|
||||
ctx->callable);
|
||||
}
|
||||
else {
|
||||
PyErr_Clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue