pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.25k stars 921 forks source link

Improve transport types #2090

Closed alexrudd2 closed 6 months ago

alexrudd2 commented 6 months ago

The first commit is straightforward.

For the second one, mypy complains that we are passing asyncio.CancelledError to close which only takes Exception. As of Python 3.8 asyncio.CancelledError is dervied from BaseException instead. It will therefore not be caught or suppressed by anything acting on Exception.

https://github.com/pymodbus-dev/pymodbus/blob/7c4a310e10abfc17b42330c3474758b67e50dda8/pymodbus/transport/serialtransport.py#L53-L55

I don't see any use in passing it, so I just used None. The alternative is to just type: ignore