Closed Ultrasonic1209 closed 1 month ago
I don't quite follow the screenshots or what they mean, but this sounds like a pylance/vscode bug, not pyzmq. Futures are awaitable.
The important thing here is that if these methods were changed to coroutines, the typing would not change. That wouldn't be true if they were typed as the more specific Future.
Ah, I think this is actually the same as the (pylance) bug causing #2028, so your zmq.asyncio.Context is ending up typed as zmq.Context, instead. The fix is probably the same. I think if you cast your Context to zmq.asyncio.Context, the typing of your Socket will be fixed.
I see it now, the async sockets don't have annotations for some of the wrapper methods. Should be easy enough to fix, I think. Thanks for the report!
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.11.10, via
uv venv
OS
Debian 11 (WSL2) - VSCode Dev Container
What happened?
zmq.asyncio.Socket.send_pyobj
returns a Future, but is not typed as such.This is VSCode (Pylance) incorrectly stating that the function return is not awaitable:
And this is VSCode's debugger showing that the function does return an awaitable:
Code to reproduce bug
Traceback, if applicable
No response
More info
No response