Skip to content

Auto-resolve addresses in socket methods #377

@njsmith

Description

@njsmith

Currently, one of the awkward differences between socket and trio.socket – really the last awkward difference as of v0.2.0 – is that with socket, you can pass hostnames directly to socket methods, like sock.bind(("localhost", 0)) or sock.connect(("python.org", 443)). In Trio these methods currently require numeric addresses, and there are the extra methods resolve_local_address and resolve_remote_address that do the resolution for you.

This was always a little weird, and really the only compelling reason was because bind as synchronous. But it turns out that bind should be async after all (#241). So we might as well get rid of this last piece of weirdness.

Plan:

  • Make bind, connect, etc. all call resolve_local_address/resolve_remote_address automatically as needed
  • Deprecate resolve_local_address/resolve_remote_address

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions