Simplify socket_repr() by using PyUnicode_FromFormat()
directly. Add a test that calls socket_repr().
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index eca29dd..4ae745c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2787,13 +2787,11 @@
 		return NULL;
 	}
 #endif
-	PyOS_snprintf(
-		buf, sizeof(buf),
+	return PyUnicode_FromFormat(
 		"<socket object, fd=%ld, family=%d, type=%d, proto=%d>",
 		(long)s->sock_fd, s->sock_family,
 		s->sock_type,
 		s->sock_proto);
-	return PyUnicode_FromString(buf);
 }