Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve transport types #2090

Merged
merged 2 commits into from
Mar 7, 2024
Merged

Improve transport types #2090

merged 2 commits into from
Mar 7, 2024

Conversation

alexrudd2
Copy link
Collaborator

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.

if exc:
with contextlib.suppress(Exception):
self.intern_protocol.connection_lost(exc)

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

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks,

@janiversen janiversen merged commit d6704a2 into dev Mar 7, 2024
1 check passed
@janiversen janiversen deleted the transport-types branch March 7, 2024 07:29
janiversen pushed a commit to dnssoftware/pymodbus that referenced this pull request Mar 17, 2024
* improve types

* asyncio.CancelledError is no longer derived from Exception
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants