summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-11-03 07:45:53 (GMT)
committerGitHub <noreply@github.com>2023-11-03 07:45:53 (GMT)
commit26c0e5e03a8603eccfd98045bc69fde2e24682e3 (patch)
tree01d7dc811329b0387323350fa881a3301affe461 /Modules/_ctypes
parent0d3df272fbd131bff7f02d4d4279ad1e35081121 (diff)
downloadcpython-26c0e5e03a8603eccfd98045bc69fde2e24682e3.zip
cpython-26c0e5e03a8603eccfd98045bc69fde2e24682e3.tar.gz
cpython-26c0e5e03a8603eccfd98045bc69fde2e24682e3.tar.bz2
gh-108082: Remove _PyErr_WriteUnraisableMsg() (GH-111643)
Replace the remaining calls with PyErr_FormatUnraisable().
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/callbacks.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 1bd8fec..154e9f4 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -9,7 +9,6 @@
#endif
#include "pycore_call.h" // _PyObject_CallNoArgs()
-#include "pycore_pyerrors.h" // _PyErr_WriteUnraisableMsg()
#include "pycore_runtime.h" // _Py_ID()
#include <stdbool.h>
@@ -216,8 +215,9 @@ static void _CallPythonObject(void *mem,
result = PyObject_Vectorcall(callable, args, nargs, NULL);
if (result == NULL) {
- _PyErr_WriteUnraisableMsg("on calling ctypes callback function",
- callable);
+ PyErr_FormatUnraisable(
+ "Exception ignored on calling ctypes callback function %R",
+ callable);
}
#ifdef MS_WIN32
@@ -258,9 +258,10 @@ static void _CallPythonObject(void *mem,
if (keep == NULL) {
/* Could not convert callback result. */
- _PyErr_WriteUnraisableMsg("on converting result "
- "of ctypes callback function",
- callable);
+ PyErr_FormatUnraisable(
+ "Exception ignored on converting result "
+ "of ctypes callback function %R",
+ callable);
}
else if (setfunc != _ctypes_get_fielddesc("O")->setfunc) {
if (keep == Py_None) {
@@ -270,9 +271,10 @@ static void _CallPythonObject(void *mem,
else if (PyErr_WarnEx(PyExc_RuntimeWarning,
"memory leak in callback function.",
1) == -1) {
- _PyErr_WriteUnraisableMsg("on converting result "
- "of ctypes callback function",
- callable);
+ PyErr_FormatUnraisable(
+ "Exception ignored on converting result "
+ "of ctypes callback function %R",
+ callable);
}
}
}