pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.18k stars 895 forks source link

Solve bytes return in base.py #1985

Closed janiversen closed 5 months ago

janiversen commented 5 months ago

Reminder for myself,

This should be changed to None or an empty ModbusResponse line 163-165 in base.py

if self.broadcast_enable and not request.slave_id: resp = b"Broadcast write sent - no response expected" break these are the lines in async_execute which cause there to be a bytes return i declared async_execute as returning ModbusResponse to allow type: ignore to work on the return type. Otherwise mypy would complain a lot about this. I do not know why this code was accepted in the first place