Skip to content

Commit 6d29cc9

Browse files
committed
fix: modify unpack_int return type
1 parent 68632c5 commit 6d29cc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: pymysqlreplication/packet.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,15 @@ def read_int64(self) -> int:
343343
def unpack_uint16(self, n: bytes) -> int:
344344
return struct.unpack('<H', n[0:2])[0]
345345

346-
def unpack_int24(self, n: bytes) -> Optional[str, Tuple[str, int]]:
346+
def unpack_int24(self, n: bytes) -> Optional[Union[int, Tuple[str, int]]]:
347347
try:
348348
return struct.unpack('B', n[0])[0] \
349349
+ (struct.unpack('B', n[1])[0] << 8) \
350350
+ (struct.unpack('B', n[2])[0] << 16)
351351
except TypeError:
352352
return n[0] + (n[1] << 8) + (n[2] << 16)
353353

354-
def unpack_int32(self, n: bytes) -> Optional[str, Tuple[str, int]]:
354+
def unpack_int32(self, n: bytes) -> Optional[Union[int, Tuple[str, int]]]:
355355
try:
356356
return struct.unpack('B', n[0])[0] \
357357
+ (struct.unpack('B', n[1])[0] << 8) \

0 commit comments

Comments
 (0)