Skip to content

Commit 38a75d3

Browse files
committed
patch for windows & non-posix compliant platforms
1 parent b556774 commit 38a75d3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Modules/_threadmodule.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2576,7 +2576,9 @@ _thread.set_name
25762576
Set the name of the current thread.
25772577
[clinic start generated code]*/
25782578

2579-
// Helper to set the thread name using platform-specific APIs
2579+
2580+
#ifndef MS_WINDOWS
2581+
// Helper to set the thread name using platform-specific APIs (POSIX only)
25802582
static int
25812583
_set_thread_name(const char *name)
25822584
{
@@ -2596,18 +2598,18 @@ _set_thread_name(const char *name)
25962598
#endif
25972599
return rc;
25982600
}
2601+
#endif // !MS_WINDOWS
2602+
25992603

26002604
static PyObject *
26012605
_thread_set_name_impl(PyObject *module, PyObject *name_obj)
26022606
/*[clinic end generated code: output=402b0c68e0c0daed input=7e7acd98261be82f]*/
26032607
{
26042608
#ifndef MS_WINDOWS
2609+
// POSIX and non-Windows platforms
26052610
#ifdef __sun
2606-
// Solaris always uses UTF-8
26072611
const char *encoding = "utf-8";
26082612
#else
2609-
// Encode the thread name to the filesystem encoding using the "replace"
2610-
// error handler
26112613
PyInterpreterState *interp = _PyInterpreterState_GET();
26122614
const char *encoding = interp->unicode.fs_codec.encoding;
26132615
#endif

0 commit comments

Comments
 (0)