Skip to content

Commit 3744db3

Browse files
committed
fix(redis): make xadd fields CovariantMapping
Using an InvariantMapping is wrong, the type of each values of the dict can be different. This change uses a Protocol instead to match as much as possible the code: ``` if not isinstance(fields, dict) or len(fields) == 0: raise DataError("XADD fields must be a non-empty dict") for pair in fields.items(): pieces.extend(pair) ```
1 parent ec52bf1 commit 3744db3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stubs/redis/redis/commands/core.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ class StreamCommands:
863863
def xadd(
864864
self,
865865
name: KeyT,
866-
fields: Mapping[bytes | memoryview | str | float, bytes | memoryview | str | float],
866+
fields: SupportItems[bytes | memoryview | str | float],
867867
id: str | int | bytes | memoryview = "*",
868868
maxlen=None,
869869
approximate: bool = True,
@@ -929,7 +929,7 @@ class AsyncStreamCommands:
929929
async def xadd(
930930
self,
931931
name: KeyT,
932-
fields: Mapping[bytes | memoryview | str | float, bytes | memoryview | str | float],
932+
fields: SupportItems[bytes | memoryview | str | float],
933933
id: str | int | bytes | memoryview = "*",
934934
maxlen=None,
935935
approximate: bool = True,

0 commit comments

Comments
 (0)