Skip to content

Commit e54e9a5

Browse files
committed
fix: add union for multiple optional types
1 parent 6d29cc9 commit e54e9a5

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
@@ -371,7 +371,7 @@ def read_binary_json(self, size: int) -> Optional[str]:
371371

372372
return self.read_binary_json_type(t, length)
373373

374-
def read_binary_json_type(self, t: int, length: int) -> Optional[bool, str]:
374+
def read_binary_json_type(self, t: int, length: int) -> Optional[Union[bool, str]]:
375375
large = (t in (JSONB_TYPE_LARGE_OBJECT, JSONB_TYPE_LARGE_ARRAY))
376376
if t in (JSONB_TYPE_SMALL_OBJECT, JSONB_TYPE_LARGE_OBJECT):
377377
return self.read_binary_json_object(length - 1, large)
@@ -404,7 +404,7 @@ def read_binary_json_type(self, t: int, length: int) -> Optional[bool, str]:
404404

405405
raise ValueError('Json type %d is not handled' % t)
406406

407-
def read_binary_json_type_inlined(self, t: bytes, large: bool) -> Optional[bool, str]:
407+
def read_binary_json_type_inlined(self, t: bytes, large: bool) -> Optional[Union[bool, str]]:
408408
if t == JSONB_TYPE_LITERAL:
409409
value = self.read_uint32() if large else self.read_uint16()
410410
if value == JSONB_LITERAL_NULL:

0 commit comments

Comments
 (0)