Repository navigation
gh-158893: Make os.strerror() thread-safe - #158927
Conversation
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.
|
The test depends on PR #158926. Without the second PR, the test is always skipped. |
|
Oh. Build fails on Android. It seems like Android C library (bionic) uses the GNU API for |
|
I clicked on [Update branch] to retrieve the sysconfig change, to run the test on Free Threaded builds. |
|
!buildbot FreeBSD15 NoGIL |
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 7d18e20 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F158927%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
The build https://buildbot.python.org/#/builders/2369/builds/1 failed because of test_free_threading.test_capi which is unrelated to this change, and I wrote #158935 to fix this test. The test passed successfully! I ran manually |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Sorry, @vstinner, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
Sorry, @vstinner, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
I will backport the fix to 3.14 and 3.15 branches once the 3.15 branch will be unblocked (next week). Right now, there are too many backports to 3.15 in the queue. |
|
I created #159120 backport to 3.15 which combines multiple commits. |
* 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)
* 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)
[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)
Make os.strerror() thread-safe: use the reentrant strerror_r() function if available.