<div dir="ltr"><div><div>Greetings, learned Python devs! <br><br></div>Apologies in advance if my message is misdirected. I'm building Python 3.3.2-r2 from Gentoo's Portage tree [1] and encountered two failed tests which probably should not have been attempted on my OS (Gentoo 3.7.10): test_bind_port and test_find_unused_port both use the SO_REUSEPORT socket option which, to the best of my knowledge is only available since kernel version 3.9. I was able to build by skipping the tests — but I believe the tests are there for a reason, and it would be best if a test that is known to fail should be skipped (or replaced with a fallback that is likely to succeed). Issue # 16594 [3] may be related (not sure). <br>
<br></div>Is it possible to detect the kernel version and skip (or modify) these tests if SO_REUSEPORT is not available? If I'm missing something obvious (or should be reporting this elsewhere), please educate me so I can better respect your attention next time around :] <br>
<div><div><div><div><br></div><div><br></div><div>+=== excerpt of portage build log: <br></div><div>======================================================================<br>ERROR: test_bind_port (test.test_support.TestSupport)<br>
----------------------------------------------------------------------<br>Traceback (most recent call last):<br>  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.3.2/Lib/test/test_support.py", line 87, in test_bind_port<br>
    support.bind_port(s)<br>  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.3.2/Lib/test/support.py", line 548, in bind_port<br>    if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:<br>
OSError: [Errno 92] Protocol not available<br><br>======================================================================<br>ERROR: test_find_unused_port (test.test_support.TestSupport)<br>----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.3.2/Lib/test/test_support.py", line 80, in test_find_unused_port<br>    port = support.find_unused_port()<br>
  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.3.2/Lib/test/support.py", line 522, in find_unused_port<br>    port = bind_port(tempsock)<br>  File "/var/tmp/portage/dev-lang/python-3.3.2-r2/work/Python-3.3.2/Lib/test/support.py", line 548, in bind_port<br>
    if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:<br>OSError: [Errno 92] Protocol not available<br>===+ <br><br>[1]: <a href="https://packages.gentoo.org/package/dev-lang/python">https://packages.gentoo.org/package/dev-lang/python</a><br>
[2]: <a href="https://lwn.net/Articles/542629/">https://lwn.net/Articles/542629/</a><br>[3]: <a href="http://bugs.python.org/issue16594">http://bugs.python.org/issue16594</a><br><br>-- <br></div><div>Best regards, <br></div>
<div>Reuben Garrett <br><br></div></div></div></div></div>