__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.)
__hash__()was added toSocketso aSocketcould be put in a dict, for use in theadafruit_requestslibrary. 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 ofSocketinadafruit_requestsreally needs a dictionary. I see two uses:._open_socketsand._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. (
SSLSockethas the same hash.)