mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
[3.13] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) (GH-128023)
- Add a helper to set an error from locale-encoded `char*`
- Use the helper for gdbm & dlerror messages
(cherry picked from commit 7303f06846
)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
367ea89384
commit
fe08cdf265
12 changed files with 176 additions and 69 deletions
|
@ -374,6 +374,7 @@ pymain_run_file_obj(PyObject *program_name, PyObject *filename,
|
|||
if (fp == NULL) {
|
||||
// Ignore the OSError
|
||||
PyErr_Clear();
|
||||
// TODO(picnixz): strerror() is locale dependent but not PySys_FormatStderr().
|
||||
PySys_FormatStderr("%S: can't open file %R: [Errno %d] %s\n",
|
||||
program_name, filename, errno, strerror(errno));
|
||||
return 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue