You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The socket options exposed by CPython's socket module do not include IP_FREEBIND, meaning the option number has to be hardcoded. Examples of this in the wild can be find using GitHub's code search.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Activity
[-]`socket.IP_FREEBIND`[/-][+]Add `socket.IP_FREEBIND` constant[/+]picnixz commentedon Apr 26, 2025
What kind of code search did you do for that? could you share your findings? (I don't mind adding this constant if it's that useful though so TiA)
alyssais commentedon Apr 26, 2025
https://github.com/search?q=setsockopt+IP_FREEBIND+15+language%3APython&type=code
You can see lots of different approaches to work around the lack of this constant.
I'll make a PR shortly.
pythongh-132991: Add socket.IP_FREEBIND constant
pythongh-132991: Add socket.IP_FREEBIND constant
picnixz commentedon Apr 26, 2025
Thanks. Is there something we however need to do in particular with this constant? should we handle it specifically in some contexts? (I don't know)
alyssais commentedon Apr 26, 2025
No, it's just for passing to setsockopt().
pythongh-132991: Add socket.IP_FREEBIND constant
gh-132991: Add socket.IP_FREEBIND constant (GH-132998)