Skip to content

SocketPool.Socket.__hash__() is not immutable #4101

Closed
@dhalbert

Description

@dhalbert

__hash__() was added to Socket so a Socket could be put in a dict, for use in the adafruit_requests library. However, the hash used is not immutable, and changes when the socket is closed.

The hash returned could be id(), to make it immutable.. However, it might be worth looking at whether the use of Socket in adafruit_requests really needs a dictionary. I see two uses: ._open_sockets and ._socket_free. I'll bring this up in an issue in that repo.

Tagging @hierophect on this, who was trying to debug #4061, which may be caused by this. (SSLSocket has the same hash.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions