Skip to content

Commit 04e0812

Browse files
committed
Merge pull request #51 from msgpack/revert-skip-reserved
Revert skipping reserved bytes.
2 parents f0fd90a + 38a9ad9 commit 04e0812

File tree

3 files changed

+179
-235
lines changed

3 files changed

+179
-235
lines changed

msgpack/fallback.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def getvalue(self):
4848
PackValueError,
4949
ExtraData)
5050

51-
EX_SKIP = 0
51+
EX_SKIP = 0
5252
EX_CONSTRUCT = 1
5353
EX_READ_ARRAY_HEADER = 2
5454
EX_READ_MAP_HEADER = 3
@@ -57,7 +57,6 @@ def getvalue(self):
5757
TYPE_ARRAY = 1
5858
TYPE_MAP = 2
5959
TYPE_RAW = 3
60-
TYPE_RESERVED = 4
6160

6261
DEFAULT_RECURSE_LIMIT=511
6362

@@ -338,13 +337,11 @@ def _read_header(self, execute=EX_CONSTRUCT, write_bytes=None):
338337
n = struct.unpack(">I", self._fb_read(4, write_bytes))[0]
339338
typ = TYPE_MAP
340339
else:
341-
typ = TYPE_RESERVED
340+
raise UnpackValueError("Unknown header: 0x%x" % b)
342341
return typ, n, obj
343342

344343
def _fb_unpack(self, execute=EX_CONSTRUCT, write_bytes=None):
345-
typ = TYPE_RESERVED
346-
while typ == TYPE_RESERVED:
347-
typ, n, obj = self._read_header(execute, write_bytes)
344+
typ, n, obj = self._read_header(execute, write_bytes)
348345

349346
if execute == EX_READ_ARRAY_HEADER:
350347
if typ != TYPE_ARRAY:

0 commit comments

Comments
 (0)