Pass mypy checks (in lint job, via tox)#918
Merged
Merged
Conversation
Fixes: src\paho\mqtt\client.py:1698: error: Item "None" of "socket | None" has no attribute "recv" [union-attr]
Matches return type of _encode_payload. Fixes: src\paho\mqtt\client.py:1781: error: Incompatible types in assignment (expression has type "bytes | bytearray", variable has type "bytes") [assignment]
Fixes: src\paho\mqtt\client.py:3444: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3572: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3610: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3652: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3701: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type]
Fixes: src\paho\mqtt\client.py:2233: error: Incompatible types in assignment (expression has type "bytes | bytearray", variable has type "bytes") [assignment] src\paho\mqtt\client.py:3444: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3572: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3610: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3652: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:3701: error: Argument 2 to "_packet_queue" of "Client" has incompatible type "bytearray"; expected "bytes" [arg-type] src\paho\mqtt\client.py:4628: error: Module has no attribute "AF_UNIX"; maybe "AF_IPX"? [attr-defined] src\paho\mqtt\client.py:4921: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
This was referenced Jun 11, 2026
PierreF
requested changes
Jun 11, 2026
Co-authored-by: Pierre Fersing <pierref@pierref.org>
pswsm
reviewed
Jun 12, 2026
pswsm
left a comment
Contributor
There was a problem hiding this comment.
Minor style diffs, feel free to ignore them.
Co-authored-by: pswsm <53122461+pswsm@users.noreply.github.com>
Co-authored-by: pswsm <53122461+pswsm@users.noreply.github.com>
pswsm
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #917, #919, & #920
Created PRs to fix those two test failures, and rebased this PR onto them both.
I'm not sure why there is a test failure on tear down (on Python 3.8 only) - I'll look into it. The test 'failure' on Python 3.7 is probably because Github's setup Python action no longer supports Python 3.7There is only one non-trivial change to run time code - coercing
resultto bytes from bytesarray, to ensure_WebSocketWrapper._recv_impl's returned values really are bytes (its declared return type). The two trivial run time changes are to re order a simpleandexpression to assist mypy, and to importoverloadfrom typing. All other changes are to type annotations only.Before I renamed the branch:
