summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>2024-12-17 11:12:45 (GMT)
committerGitHub <noreply@github.com>2024-12-17 11:12:45 (GMT)
commit7303f06846b69016a075bca7ad7c6055f29ad024 (patch)
treefa3abb9f0a3b3b18bbd60590cbfb1c3c6a91d70f /Include
parentb9a492b809d8765ee365a5dd3c6ba4e5130a80af (diff)
downloadcpython-7303f06846b69016a075bca7ad7c6055f29ad024.zip
cpython-7303f06846b69016a075bca7ad7c6055f29ad024.tar.gz
cpython-7303f06846b69016a075bca7ad7c6055f29ad024.tar.bz2
gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746)
- Add a helper to set an error from locale-encoded `char*` - Use the helper for gdbm & dlerror messages Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_pyerrors.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h
index 02945f0..6f2fdda 100644
--- a/Include/internal/pycore_pyerrors.h
+++ b/Include/internal/pycore_pyerrors.h
@@ -130,6 +130,18 @@ PyAPI_FUNC(void) _PyErr_SetString(
PyObject *exception,
const char *string);
+/*
+ * Set an exception with the error message decoded from the current locale
+ * encoding (LC_CTYPE).
+ *
+ * Exceptions occurring in decoding take priority over the desired exception.
+ *
+ * Exported for '_ctypes' shared extensions.
+ */
+PyAPI_FUNC(void) _PyErr_SetLocaleString(
+ PyObject *exception,
+ const char *string);
+
PyAPI_FUNC(PyObject*) _PyErr_Format(
PyThreadState *tstate,
PyObject *exception,