redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

New release 5.0.0 returns error with pyright

Open sylvainmouquet opened this issue 2 years ago • 2 comments

Hello,

pyright returns a error with the new version :

Version: 5.0.0

Platform: MacOs amd64

Description:

for l in redis.xread({"events": "0"}, count=100000, block=0):

« Awaitable[Unknown] » n’est pas itérable
  Méthode « __iter__ » non définie

sylvainmouquet avatar Aug 17 '23 13:08 sylvainmouquet

I'm having the same issues using pyright==1.1.323. xread() method is typed as returning ResponseT which is a type-alias for Union[Awaitable, Any]. From pyright's point of view this kinda makes sense, as an Awaitable and Any is indeed quite different.

Does it exist any suggested way of telling the type-checker whether we are using sync or async Redis to avoid this, or is this a bug?

einarwar avatar Aug 21 '23 09:08 einarwar

Relevant: https://github.com/redis/redis-py/issues/3497

mvanderlee avatar Apr 20 '25 13:04 mvanderlee