Repository navigation
gh-158893: Add internal _Py_strerror() function - #158982
Merged
Merged
Conversation
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).
Member
Author
|
On FreeBSD 14, I can reproduce the issue by running test_concurrent_initialization_subinterpreter() of test_datetime in a loop. For example, it crashed at the 4th run: With the fix, the test no longer crash. I ran the test 188 times in 6 minutes. |
Member
Author
|
Oh, CIFuzz jobs failed with networking issue. Example:
|
vstinner
enabled auto-merge (squash)
October 7, 2026 20:23
vstinner
added a commit
that referenced
this pull request
Oct 10, 2026
* gh-157695: Parse also _Py_HAVE_xxx variables in sysconfig (#158926) Add parse_config_h() tests to test_sysconfig. (cherry picked from commit 978a8be) * gh-158893: Make os.strerror() thread-safe (#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. * gh-158893: Add internal _Py_strerror() function (#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)
vstinner
added a commit
to vstinner/cpython
that referenced
this pull request
Oct 10, 2026
* 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
added a commit
that referenced
this pull request
Oct 10, 2026
[3.15] gh-158893: Make os.strerror() thread-safe (#159120) * gh-157695: Parse also _Py_HAVE_xxx variables in sysconfig (#158926) Add parse_config_h() tests to test_sysconfig. (cherry picked from commit 978a8be) * gh-158893: Make os.strerror() thread-safe (#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. * gh-158893: Add internal _Py_strerror() function (#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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).