Skip to content

Commit bdfa0eb

Browse files
committed
#26907: add some missing getsockopt constants.
Patch by Christian Heimes, reviewed by Martin Panter.
1 parent d44500c commit bdfa0eb

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

Doc/library/socket.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ Constants
281281
in the Unix header files are defined; for a few symbols, default values are
282282
provided.
283283

284+
.. versionchanged:: 3.6
285+
``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``
286+
were added.
287+
284288
.. data:: AF_CAN
285289
PF_CAN
286290
SOL_CAN_*

Doc/whatsnew/3.6.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ The :func:`~socket.socket.ioctl` function now supports the :data:`~socket.SIO_LO
406406
control code.
407407
(Contributed by Daniel Stokes in :issue:`26536`.)
408408

409+
The :meth:`~socket.socket.getsockopt` constants ``SO_DOMAIN``,
410+
``SO_PROTOCOL``, ``SO_PEERSEC``, and ``SO_PASSSEC`` are now supported.
411+
(Contributed by Christian Heimes in :issue:`26907`.)
412+
409413

410414
socketserver
411415
------------

Modules/socketmodule.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6582,6 +6582,12 @@ PyInit__socket(void)
65826582
#ifdef LOCAL_PEERCRED
65836583
PyModule_AddIntMacro(m, LOCAL_PEERCRED);
65846584
#endif
6585+
#ifdef SO_PASSSEC
6586+
PyModule_AddIntMacro(m, SO_PASSSEC);
6587+
#endif
6588+
#ifdef SO_PEERSEC
6589+
PyModule_AddIntMacro(m, SO_PEERSEC);
6590+
#endif
65856591
#ifdef SO_BINDTODEVICE
65866592
PyModule_AddIntMacro(m, SO_BINDTODEVICE);
65876593
#endif
@@ -6591,6 +6597,12 @@ PyInit__socket(void)
65916597
#ifdef SO_MARK
65926598
PyModule_AddIntMacro(m, SO_MARK);
65936599
#endif
6600+
#ifdef SO_DOMAIN
6601+
PyModule_AddIntMacro(m, SO_DOMAIN);
6602+
#endif
6603+
#ifdef SO_PROTOCOL
6604+
PyModule_AddIntMacro(m, SO_PROTOCOL);
6605+
#endif
65946606

65956607
/* Maximum number of connections for "listen" */
65966608
#ifdef SOMAXCONN

0 commit comments

Comments
 (0)