Skip to content

Add socket.IP_FREEBIND constant #132991

Closed
Closed

Description

@alyssais

Feature or enhancement

Proposal:

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

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. changed the title [-]`socket.IP_FREEBIND`[/-] [+]Add `socket.IP_FREEBIND` constant[/+] on Apr 26, 2025
  2. picnixz commented on Apr 26, 2025

    @picnixz
    Member

    Examples of this in the wild can be find using GitHub's code search.

    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)

  3. alyssais commented on Apr 26, 2025

    @alyssais
    ContributorAuthor

    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.

  4. added 2 commits that reference this issue on Apr 26, 2025
  5. picnixz commented on Apr 26, 2025

    @picnixz
    Member

    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)

  6. alyssais commented on Apr 26, 2025

    @alyssais
    ContributorAuthor

    No, it's just for passing to setsockopt().

  7. added a commit that references this issue on Apr 26, 2025
  8. added a commit that references this issue on Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions