Skip to content

Commit f544b4e

Browse files
committed
Fix type of _protocol field
1 parent 992b394 commit f544b4e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/paho/mqtt/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def __init__(
732732
client_id: str | None = "",
733733
clean_session: bool | None = None,
734734
userdata: Any = None,
735-
protocol: int = MQTTv311,
735+
protocol: MQTTProtocolVersion = MQTTv311,
736736
transport: Literal["tcp", "websockets"] = "tcp",
737737
reconnect_on_failure: bool = True,
738738
manual_ack: bool = False,
@@ -3462,7 +3462,7 @@ def _send_simple_command(self, command: int) -> MQTTErrorCode:
34623462
return self._packet_queue(command, packet, 0, 0)
34633463

34643464
def _send_connect(self, keepalive: int) -> MQTTErrorCode:
3465-
proto_ver = self._protocol
3465+
proto_ver = int(self._protocol)
34663466
# hard-coded UTF-8 encoded string
34673467
protocol = b"MQTT" if proto_ver >= MQTTv311 else b"MQIsdp"
34683468

src/paho/mqtt/publish.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from collections.abc import Iterable
2525
from typing import TYPE_CHECKING, Any, List, Tuple, Union
2626

27-
from paho.mqtt.enums import CallbackAPIVersion
27+
from paho.mqtt.enums import CallbackAPIVersion, MQTTProtocolVersion
2828
from paho.mqtt.properties import Properties
2929
from paho.mqtt.reasoncodes import ReasonCode
3030

@@ -112,7 +112,7 @@ def multiple(
112112
will: MessageDict | None = None,
113113
auth: AuthParameter | None = None,
114114
tls: TLSParameter | None = None,
115-
protocol: int = paho.MQTTv311,
115+
protocol: MQTTProtocolVersion = paho.MQTTv311,
116116
transport: Literal["tcp", "websockets"] = "tcp",
117117
proxy_args: Any | None = None,
118118
) -> None:
@@ -240,7 +240,7 @@ def single(
240240
will: MessageDict | None = None,
241241
auth: AuthParameter | None = None,
242242
tls: TLSParameter | None = None,
243-
protocol: int = paho.MQTTv311,
243+
protocol: MQTTProtocolVersion = paho.MQTTv311,
244244
transport: Literal["tcp", "websockets"] = "tcp",
245245
proxy_args: Any | None = None,
246246
) -> None:

0 commit comments

Comments
 (0)