Skip to content

[3.14] gh-158893: Make os.strerror() thread-safe (#159120) - #159145

Merged
vstinner merged 1 commit into
python:3.14from
vstinner:strerror14
Oct 10, 2026
Merged

vstinner merged 1 commit into
python:3.14from
vstinner:strerror14

Conversation

@vstinner

Copy link
Copy Markdown
Member

Add parse_config_h() tests to test_sysconfig.

(cherry picked from commit 978a8be)

Make os.strerror() thread-safe: use the reentrant strerror_r() function if available.

Add a new internal _Py_strerror() function to Python/fileutils.c. It uses strerror_r() if available, or use strerror() otherwise.

Replace all strerror(code) calls with _Py_strerror(code).

(cherry picked from commit 15dd735) (cherry picked from commit c774d15)

* pythongh-157695: Parse also _Py_HAVE_xxx variables in sysconfig (python#158926)

Add parse_config_h() tests to test_sysconfig.

(cherry picked from commit 978a8be)

* pythongh-158893: Make os.strerror() thread-safe (python#158927)

Make os.strerror() thread-safe: use the reentrant strerror_r()
function if available.

* The configure script now checks if strerror_r() is supported.
* Add a stress test to test_free_threading.test_os (new module).
* Add a comment on decode_current_locale() assertion which fails if
  the input string is mutated.
* Add an assertion to _Py_DecodeLocale() to detect if the input
  string was mutated during the function call.

* pythongh-158893: Add internal _Py_strerror() function (python#158982)

Add a new internal _Py_strerror() function to Python/fileutils.c. It
uses strerror_r() if available, or use strerror() otherwise.

Replace all strerror(code) calls with _Py_strerror(code).

(cherry picked from commit 15dd735)
(cherry picked from commit c774d15)
@vstinner

Copy link
Copy Markdown
Member Author

Note: the sysconfig backport doesn't strip quotes from variables (no behavior change), it's different from 3.15 and main branches.

@vstinner
vstinner merged commit b23d657 into python:3.14 Oct 10, 2026
54 checks passed
@vstinner
vstinner deleted the strerror14 branch October 10, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant