Description
Feature or enhancement
Proposal:
This is a follow-up to the discussion in #126555 (comment).
dlerror()
may return non-UTF-8 messages, possibly translated. We should be able to set exception messages according to the current locale. To that end, we'll expose some internal helper:
extern void
_PyErr_SetLocaleStringTstate(PyThreadState *tstate, PyObject *exception, const char *string);
extern void
_PyErr_SetLocaleString(PyObject *exception, const char *string);
For now, both functions would be only declared as extern
and not part of the public C API.
Linked PRs
-
[3.13] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) #128023
-
[3.12] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) #128027
-
gh-126742: avoid checking for library filename in
dlerror()
error messages #128034 -
[3.13] gh-126742: Avoid checking for library filename in test_ctypes (GH-128034) #128056
-
[3.12] gh-126742: Avoid checking for library filename in test_ctypes (GH-128034) #128057
-
[3.13] gh-126742: add NEWS entry for fix of localized error messages (GH-128025) #128059
-
[3.12] gh-126742: add NEWS entry for fix of localized error messages (GH-128025) #128060