bpo-34932: Add socket.TCP_KEEPALIVE for macOS (GH-25079)
(cherry picked from commit d59d7374a364c4e5c2b9a83d8e4543ee494285b8)
Co-authored-by: Shane Harvey <shnhrv@gmail.com>
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 142cc7c..9233430 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -8159,6 +8159,10 @@ PyInit__socket(void)
#ifdef TCP_KEEPIDLE
PyModule_AddIntMacro(m, TCP_KEEPIDLE);
#endif
+ /* TCP_KEEPALIVE is OSX's TCP_KEEPIDLE equivalent */
+#if defined(__APPLE__) && defined(TCP_KEEPALIVE)
+ PyModule_AddIntMacro(m, TCP_KEEPALIVE);
+#endif
#ifdef TCP_KEEPINTVL
PyModule_AddIntMacro(m, TCP_KEEPINTVL);
#endif