From a2554b0e2ab3bac73bacfbccefb6d797dffa62f4 Mon Sep 17 00:00:00 2001 From: MAKOMO Date: Thu, 24 Oct 2024 15:50:50 +0200 Subject: [PATCH] to allow to use write_registers typecorrectly with values as inhomogeneous lists of type list[int] or list[bytes] we promote the type of values from list to Sequence (see Issue #2368) --- pymodbus/client/mixin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymodbus/client/mixin.py b/pymodbus/client/mixin.py index b31e1ef87..b81ba345c 100644 --- a/pymodbus/client/mixin.py +++ b/pymodbus/client/mixin.py @@ -3,7 +3,7 @@ import struct from enum import Enum -from typing import Generic, TypeVar +from typing import Generic, TypeVar, Sequence import pymodbus.pdu.bit_read_message as pdu_bit_read import pymodbus.pdu.bit_write_message as pdu_bit_write @@ -341,7 +341,7 @@ def write_coils( def write_registers( self, address: int, - values: list[bytes | int], + values: Sequence[bytes | int], slave: int = 1, skip_encode: bool = False, no_response_expected: bool = False