Skip to content

Commit f4a9f40

Browse files
committed
Solaris always uses UTF-8
1 parent 7508b6c commit f4a9f40

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Lib/test/test_threading.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,10 @@ def work():
21282128
limit = truncate or 100
21292129

21302130
def create_test(name):
2131-
encoding = sys.getfilesystemencoding()
2131+
if sys.platform.startswith("solaris"):
2132+
encoding = "utf-8"
2133+
else:
2134+
encoding = sys.getfilesystemencoding()
21322135
encoded = name.encode(encoding, "replace")
21332136
if truncate is not None:
21342137
expected = os.fsdecode(encoded[:truncate])

Modules/_threadmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,10 +2409,15 @@ _thread_set_name_impl(PyObject *module, PyObject *name_obj)
24092409
return NULL;
24102410
}
24112411

2412+
#ifdef __sun
2413+
// Solaris always uses UTF-8
2414+
char *encoding = "utf-8";
2415+
#else
24122416
// Encode the thread name to the filesystem encoding using the "replace"
24132417
// error handler
24142418
PyInterpreterState *interp = _PyInterpreterState_GET();
24152419
char *encoding = interp->unicode.fs_codec.encoding;
2420+
#endif
24162421
PyObject *name_encoded;
24172422
name_encoded = PyUnicode_AsEncodedString(name_obj, encoding, "replace");
24182423
if (name_encoded == NULL) {

0 commit comments

Comments
 (0)