Skip to content

Registering Zyre socket fails with "TypeError: unhashable type: 'Zsock'" #751

@dweidenkopf

Description

@dweidenkopf

Unable to use Zyre with Poller. Python version 3.12, zyre 2.0.0, zeromq 4.3.5

import zmq
from zyre import Zyre


def main():
    ctx = zmq.Context()
    poller = zmq.Poller()

    zyre = Zyre("test".encode())
    zyre.join("test".encode())

    zyre.start()

    poller.register(zyre.socket(), zmq.POLLIN)

    print("Success")


if __name__ == "__main__":
    main()
host:~# python3 /tmp/poller_test.py
Traceback (most recent call last):
  File "/tmp/poller_test.py", line 20, in <module>
    main()
  File "/tmp/poller_test.py", line 14, in main
    poller.register(zyre.socket(), zmq.POLLIN)
  File "/usr/lib/python3.12/site-packages/zmq/sugar/poll.py", line 46, in register
    if socket in self._map:
       ^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'Zsock'

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