bpo-35569: Expose RFC 3542 IPv6 socket options on macOS by erlend-aasland · Pull Request #19526 · python/cpython (original) (raw)
Thanks, @ned-deily !
Your restructered
detect_socket()
looks nicer but, unless I'm missing something, it doesn't seem to behave the same as the original code. The current code doesn't attempt to build _socket on VxWorks if it can't find the netlib
directory, no?
You're right, I mistook the elif
for an else
!
This should do the trick:
def detect_socket(self):
# socket(2)
if VXWORKS:
if not self.compiler.find_library_file(self.lib_dirs, 'net'):
return
kwargs = {'libraries': ['net']}
elif MACOS:
# Issue #35569: Expose RFC 3542 socket options.
kwargs = {'extra_compile_args': ['-D__APPLE_USE_RFC_3542']}
else:
kwargs = {}
kwargs['depends'] = ['socketmodule.h']
self.add(Extension('_socket', ['socketmodule.c'], **kwargs))
Or we could just initialize kwargs
first, and drop the last else