aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2025-04-12 11:25:35 +0300
committerGitHub <noreply@github.com>2025-04-12 11:25:35 +0300
commitd4e2cdc15bdfe84486b885eca885c44bc378fc41 (patch)
treeda35113a65c792b101363ed0cda57bf61d7d476c /Python
parenta81232c769a4f67ee312c5c67a2148c54c6570d0 (diff)
downloadcpython-d4e2cdc15bdfe84486b885eca885c44bc378fc41.tar.gz
cpython-d4e2cdc15bdfe84486b885eca885c44bc378fc41.zip
gh-125434: Fix building on OpenBSD (GH-132393)
pthread_get_name_np is defined in pthread_np.h.
Diffstat (limited to 'Python')
-rw-r--r--Python/traceback.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 6a6a3c29859..d30ba586cfc 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -1039,6 +1039,17 @@ _Py_DumpTraceback(int fd, PyThreadState *tstate)
dump_traceback(fd, tstate, 1);
}
+#if defined(HAVE_PTHREAD_GETNAME_NP) || defined(HAVE_PTHREAD_GET_NAME_NP)
+# if defined(__OpenBSD__)
+ /* pthread_*_np functions, especially pthread_{get,set}_name_np().
+ pthread_np.h exists on both OpenBSD and FreeBSD but the latter declares
+ pthread_getname_np() and pthread_setname_np() in pthread.h as long as
+ __BSD_VISIBLE remains set.
+ */
+# include <pthread_np.h>
+# endif
+#endif
+
/* Write the thread identifier into the file 'fd': "Current thread 0xHHHH:\" if
is_current is true, "Thread 0xHHHH:\n" otherwise.