zeromq / pyzmq

PyZMQ: Python bindings for zeromq
http://zguide.zeromq.org/py:all
BSD 3-Clause "New" or "Revised" License
3.66k stars 638 forks source link

BUG: Type errors instantiating zmq.asyncio.Context #2028

Open obeattie opened 2 weeks ago

obeattie commented 2 weeks ago

This is a pyzmq bug

What pyzmq version?

26.2.0

What libzmq version?

4.3.5

Python version (and how it was installed)

Python 3.12.5

OS

macOS 14.5 (23F79)

What happened?

When instantiating an zmq.asyncio.Context exactly as described in the docs, I get a type error:

Screenshot 2024-08-31 at 8 14 43 AM

Everything is functionally fine if I add a # type: ignore to ignore the type error, but of course not ideal to have to do that!

Code to reproduce bug

import zmq.asyncio

zmq_context = zmq.asyncio.Context()

Traceback, if applicable

No response

More info

No response

minrk commented 2 weeks ago

Can you share more of how you are doing the type checking? Because all the type checking tests pass, so it might be a problem in the env or checker.

minrk commented 2 days ago

Looks like pyright doesn't understand the use of generics the same way mypy does. Fixed by #2032.

obeattie commented 2 days ago

Sorry I didn’t see the earlier reply. And thanks for fixing it! ❤️