Issue #11223: fix compiler warnings
diff --git a/Python/thread.c b/Python/thread.c
index 5213a72..1f15a22 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -420,8 +420,11 @@
 {
     PyObject *info, *value;
     int ret;
+#if (defined(_POSIX_THREADS) && defined(HAVE_CONFSTR) \
+     && defined(_CS_GNU_LIBPTHREAD_VERSION))
     char buffer[255];
     int len;
+#endif
 
     info = PyDict_New();
     if (info == NULL)