From 2f7d13473fd6b4265f6d8fa44b1b213eb3b51bc3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 11 Apr 2025 15:40:38 +0300 Subject: [PATCH] gh-125434: Fix building on OpenBSD pthread_get_name_np is defined in pthread_np.h. --- Python/traceback.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Python/traceback.c b/Python/traceback.c index 6a6a3c29859fbc..d30ba586cfcca4 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 +# endif +#endif + /* Write the thread identifier into the file 'fd': "Current thread 0xHHHH:\" if is_current is true, "Thread 0xHHHH:\n" otherwise.