mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-59705: Set OS thread name when Thread.name is changed (#127702)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
parent
9af96f4406
commit
c91ccbe4ac
4 changed files with 43 additions and 7 deletions
|
@ -2423,8 +2423,7 @@ _thread_set_name_impl(PyObject *module, PyObject *name_obj)
|
|||
|
||||
#ifdef PYTHREAD_NAME_MAXLEN
|
||||
// Truncate to PYTHREAD_NAME_MAXLEN bytes + the NUL byte if needed
|
||||
size_t len = PyBytes_GET_SIZE(name_encoded);
|
||||
if (len > PYTHREAD_NAME_MAXLEN) {
|
||||
if (PyBytes_GET_SIZE(name_encoded) > PYTHREAD_NAME_MAXLEN) {
|
||||
PyObject *truncated;
|
||||
truncated = PyBytes_FromStringAndSize(PyBytes_AS_STRING(name_encoded),
|
||||
PYTHREAD_NAME_MAXLEN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue