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
In addition to making the test more lenient, we can make _thread.set_name() more tolerant to such restriction -- use ASCII encoding with the "replace" or "ignore" error handler as a fallback.
Decided to try my first issue with Python - I attempted to create a fallback in the _threadmodule and made the test more lenient. See pull request for details.
Please let me know if this was not the issue you were describing and/or fix you were hoping for. Note that all tests (including manually testing above) ran fine on macOS, but I did not test on OpenIndiana.
Since pthread_setname_np() on OpenIndiana does nor return error, but silently does nothing, the only way to check this its to call pthread_getname_np() and compare the result with new name. But this is too much hassle.
A simpler solution is just always use ASCII on OpenIndiana. This is less generic, and we can miss when they fix this, but this is the simplest solution.
We need to add also a test for the main thread with non-ASCII name.
@vstinner I could not find a way to detect OpenIndiana with a macro in C (more specifically, differentiate it from other solaris/illumos platforms), so my new changes simply always use ASCII/replace on Solaris and OpenIndiana. If anyone does know of a way, let me know and we can change it.
Activity
jadonduff commentedon Aug 21, 2025
Decided to try my first issue with Python - I attempted to create a fallback in the _threadmodule and made the test more lenient. See pull request for details.
Please let me know if this was not the issue you were describing and/or fix you were hoping for. Note that all tests (including manually testing above) ran fine on macOS, but I did not test on OpenIndiana.
serhiy-storchaka commentedon Aug 26, 2025
This turned out to be more complicated than I thought.
The following script:
produces an expected output on Linux:
But on OpenIndiana it is:
Setting a non-ASCII name does not work in the main thread and has no effect in other threads. Setting an ASCII name works in all cases.
Adding a fallback in
_thread.set_name()only affects the main thread and does not help to solve the problem with tests.[-]test_set_name fails on OpenIndiana (and Solaris?)[/-][+]test_set_name fails on OpenIndiana[/+]serhiy-storchaka commentedon Sep 1, 2025
Since
pthread_setname_np()on OpenIndiana does nor return error, but silently does nothing, the only way to check this its to callpthread_getname_np()and compare the result with new name. But this is too much hassle.A simpler solution is just always use ASCII on OpenIndiana. This is less generic, and we can miss when they fix this, but this is the simplest solution.
We need to add also a test for the main thread with non-ASCII name.
vstinner commentedon Sep 1, 2025
In C, is there a way to detect OpenIndiana with a macro? If not, sadly, I would suggest to always use ASCII/replace on Solaris and OpenIndiana.
jadonduff commentedon Sep 2, 2025
@vstinner I could not find a way to detect OpenIndiana with a macro in C (more specifically, differentiate it from other solaris/illumos platforms), so my new changes simply always use ASCII/replace on Solaris and OpenIndiana. If anyone does know of a way, let me know and we can change it.
gh-138004: Fix setting a thread name on OpenIndiana (GH-138017)
pythongh-138004: Fix setting a thread name on OpenIndiana (pythonGH-1…
serhiy-storchaka commentedon Sep 3, 2025
Thank you for your contribution @jadonduff.
pythongh-138004: Fix setting a thread name on OpenIndiana (pythonGH-1…
[3.14] gh-138004: Fix setting a thread name on OpenIndiana (GH-138017) (