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
{{ message }}
Repository navigation
Update usages of PySys_FormatStderr with locale-dependent strerror #128022
At this point, the LC_MESSAGES locale is still the default C locale, the error message is not localized, and so is very likely an English message which is ASCII friendly.
Maybe the exception would be if Python is embedded and Py_Main() (or any other function to embed Python) is called with LC_MESSAGES configured to something else.
At this point, the LC_MESSAGES locale is still the default C locale, the error message is not localized, and so is very likely an English message which is ASCII friendly.
Oh! I thought it was already localized. So maybe it's a non-issue? I didn't investigate more in details since I'm not well-versed in embedded Python, hence the TODO I left. But if it's a non-issue, we can try:
try to use strerror() normally -> hopefully nothing fails
if we have some UnicodeDecodeError -> clear it and remove strerror()
format a new exception without the use of strerror() now.
If it's too much for something that is too rare, I think we should remove the "TODO(picnixz)" message (I can remove it as part of #128025 if the latter is not merged yet).
Activity
vstinner commentedon Dec 17, 2024
There is a simple fix: remove strerrror().
vstinner commentedon Dec 17, 2024
At this point, the
LC_MESSAGESlocale is still the defaultClocale, the error message is not localized, and so is very likely an English message which is ASCII friendly.Maybe the exception would be if Python is embedded and Py_Main() (or any other function to embed Python) is called with LC_MESSAGES configured to something else.
picnixz commentedon Dec 17, 2024
Oh! I thought it was already localized. So maybe it's a non-issue? I didn't investigate more in details since I'm not well-versed in embedded Python, hence the TODO I left. But if it's a non-issue, we can try:
strerror()normally -> hopefully nothing failsstrerror()strerror()now.If it's too much for something that is too rare, I think we should remove the "TODO(picnixz)" message (I can remove it as part of #128025 if the latter is not merged yet).