[Python-checkins] gh-89415: Add source-specific multicast constants to socket module (#103684)

gpshead webhook-mailer at python.org
Thu Apr 27 00:06:09 EDT 2023


https://github.com/python/cpython/commit/1d99e9e46e9b517532fea11befe2e6d0043850bd
commit: 1d99e9e46e9b517532fea11befe2e6d0043850bd
branch: main
author: Reese Hyde <34076153+rmehyde at users.noreply.github.com>
committer: gpshead <greg at krypto.org>
date: 2023-04-26T21:05:55-07:00
summary:

gh-89415: Add source-specific multicast constants to socket module (#103684)

Add socket options for source-specific multicast when present as C #defines.

Co-authored-by: Oleg Iarygin <dralife at yandex.ru>

files:
A Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst
M Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst b/Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst
new file mode 100644
index 000000000000..a5b99a2f1360
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst
@@ -0,0 +1,2 @@
+Add :mod:`socket` constants for source-specific multicast.
+Patch by Reese Hyde.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 656cd546d46d..f11d4b1a6e05 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -8418,6 +8418,18 @@ socket_exec(PyObject *m)
 #ifdef IP_BIND_ADDRESS_NO_PORT
     ADD_INT_MACRO(m, IP_BIND_ADDRESS_NO_PORT);
 #endif
+#ifdef IP_UNBLOCK_SOURCE
+    ADD_INT_MACRO(m, IP_UNBLOCK_SOURCE);
+#endif
+#ifdef IP_BLOCK_SOURCE
+    ADD_INT_MACRO(m, IP_BLOCK_SOURCE);
+#endif
+#ifdef IP_ADD_SOURCE_MEMBERSHIP
+    ADD_INT_MACRO(m, IP_ADD_SOURCE_MEMBERSHIP);
+#endif
+#ifdef IP_DROP_SOURCE_MEMBERSHIP
+    ADD_INT_MACRO(m, IP_DROP_SOURCE_MEMBERSHIP);
+#endif
 
     /* IPv6 [gs]etsockopt options, defined in RFC2553 */
 #ifdef  IPV6_JOIN_GROUP



More information about the Python-checkins mailing list