Skip to content

Commit 7f61ecb

Browse files
committed
Do not bother unpacking single bytes
1 parent 4592499 commit 7f61ecb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

maxminddb/decoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def decode(self, offset):
130130
offset -- the location of the data structure to decode
131131
"""
132132
new_offset = offset + 1
133-
(ctrl_byte, ) = struct.unpack(b'!B', self._buffer[offset:new_offset])
133+
ctrl_byte = int_from_byte(self._buffer[offset])
134134
type_num = ctrl_byte >> 5
135135
# Extended type
136136
if not type_num:
@@ -147,7 +147,7 @@ def decode(self, offset):
147147
return decoder(self, size, new_offset)
148148

149149
def _read_extended(self, offset):
150-
(next_byte, ) = struct.unpack(b'!B', self._buffer[offset:offset + 1])
150+
next_byte = int_from_byte(self._buffer[offset])
151151
type_num = next_byte + 7
152152
if type_num < 7:
153153
raise InvalidDatabaseError(

0 commit comments

Comments
 (0)