Show More
@@ -36,6 +36,7 b' import sys' | |||||
36 |
|
36 | |||
37 | from . import compat |
|
37 | from . import compat | |
38 |
|
38 | |||
|
39 | abc = collections.abc | |||
39 |
|
40 | |||
40 | BSER_ARRAY = b"\x00" |
|
41 | BSER_ARRAY = b"\x00" | |
41 | BSER_OBJECT = b"\x01" |
|
42 | BSER_OBJECT = b"\x01" | |
@@ -207,9 +208,7 b' class _bser_buffer:' | |||||
207 | self.ensure_size(needed) |
|
208 | self.ensure_size(needed) | |
208 | struct.pack_into(b"=cd", self.buf, self.wpos, BSER_REAL, val) |
|
209 | struct.pack_into(b"=cd", self.buf, self.wpos, BSER_REAL, val) | |
209 | self.wpos += needed |
|
210 | self.wpos += needed | |
210 |
elif isinstance(val, |
|
211 | elif isinstance(val, abc.Mapping) and isinstance(val, abc.Sized): | |
211 | val, collections.Sized |
|
|||
212 | ): |
|
|||
213 | val_len = len(val) |
|
212 | val_len = len(val) | |
214 | size = _int_size(val_len) |
|
213 | size = _int_size(val_len) | |
215 | needed = 2 + size |
|
214 | needed = 2 + size | |
@@ -260,9 +259,7 b' class _bser_buffer:' | |||||
260 | for k, v in iteritems: |
|
259 | for k, v in iteritems: | |
261 | self.append_string(k) |
|
260 | self.append_string(k) | |
262 | self.append_recursive(v) |
|
261 | self.append_recursive(v) | |
263 |
elif isinstance(val, |
|
262 | elif isinstance(val, abc.Iterable) and isinstance(val, abc.Sized): | |
264 | val, collections.Sized |
|
|||
265 | ): |
|
|||
266 | val_len = len(val) |
|
263 | val_len = len(val) | |
267 | size = _int_size(val_len) |
|
264 | size = _int_size(val_len) | |
268 | needed = 2 + size |
|
265 | needed = 2 + size |
General Comments 0
You need to be logged in to leave comments.
Login now