You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Hmm, so is PyErr_SetLocaleString supposed to be implicitly private? I'm not the biggest fan of that--if something is supposed to be private, then we need to prefix it with _, not only so users don't touch it, but so people reading the source don't mistake it as public. If we want a variation of it that takes a thread state, we could have something like _PyErr_SetLocaleStringTstate.
Activity
picnixz commentedon Nov 12, 2024
Let's actually mark it as a bugfix since we'll need to backport it in order to use it later.
ZeroIntensity commentedon Nov 12, 2024
Hmm, so is
PyErr_SetLocaleStringsupposed to be implicitly private? I'm not the biggest fan of that--if something is supposed to be private, then we need to prefix it with_, not only so users don't touch it, but so people reading the source don't mistake it as public. If we want a variation of it that takes a thread state, we could have something like_PyErr_SetLocaleStringTstate.picnixz commentedon Nov 12, 2024
For now, but maybe we can directly expose to the C API? I want to be consistent with the naming of each function.
picnixz commentedon Nov 12, 2024
Nevermind, there is a precedent:
_PyErr_FormatFromCauseTstate. Let's have_PyErr_SetLocaleStringTstateand_PyErr_SetLocaleStringand both private.encukou commentedon Nov 12, 2024
How many places in the code would use this helper? I don't see the advantage over calling
PyUnicode_DecodeLocaleandPyErr_SetObject.picnixz commentedon Nov 12, 2024
There are a few occurrences of
dlerror()in_ctypes.candcallproc.canddynload_shlibas well.NVM: the
dynload_shlibuses its own logic.22 remaining items
picnixz commentedon Dec 17, 2024
I changed the labels since we decideed to eventually treat this as a bug fix.
gh-126742: Avoid checking for library filename in test_ctypes (#128034)
pythongh-126742: Avoid checking for library filename in test_ctypes (p…
pythongh-126742: Avoid checking for library filename in test_ctypes (p…
[3.12] gh-126742: Avoid checking for library filename in test_ctypes (G…
[3.13] gh-126742: Avoid checking for library filename in test_ctypes (G…
gh-126742: add NEWS entry for fix of localized error messages (GH-128025
pythongh-126742: add NEWS entry for fix of localized error messages (p…
pythongh-126742: add NEWS entry for fix of localized error messages (p…
[3.13] gh-126742: add NEWS entry for fix of localized error messages (G…
[3.12] gh-126742: add NEWS entry for fix of localized error messages (G…
pythongh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerro…
pythongh-126742: Avoid checking for library filename in test_ctypes (p…
pythongh-126742: add NEWS entry for fix of localized error messages (p…