-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to set non-UTF8 exception messages #126742
Comments
Let's actually mark it as a bugfix since we'll need to backport it in order to use it later. |
Hmm, so is |
For now, but maybe we can directly expose to the C API? I want to be consistent with the naming of each function. |
Nevermind, there is a precedent: |
How many places in the code would use this helper? I don't see the advantage over calling |
There are a few occurrences of NVM: the |
I don't think it's worth it to add a project-wide helper here. Calling the 2 functions should be fine. |
My main arguments for adding a new internal function would be that a) it helps remove the risk of reference leaks (which in my experience, are all too common when dealing with string mutations) and b) makes it easier to deal with locale in the future (we have incorrect uses of |
As far as I know, this is not a bug on any supported platforms, and so can't be tested in our CI. It's also not been reported/patched on any other platform I know of. I don't know if it should be called a “bug” (that's more a question about the definition of the term), but I don't think a fix for this issue should be backported. Let's just improve As for the helper: IMO, it's better to first fix the code, and then, if it makes sense, refactor to add a helper. In clear-cut cases you'd combine the steps in one commit, but let's not do that here. |
FWIW, I did find BPO-41894 when looking through the places where we use |
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:cc @ZeroIntensity @encukou
For now, both functions would be only declared as
extern
and not part of the public C API.Linked PRs
The text was updated successfully, but these errors were encountered: