Show More
@@ -284,17 +284,17 b' class _lazymanifest(object):' | |||
|
284 | 284 | self.data = self.data[:cur] + '\x00' + self.data[cur + 1:] |
|
285 | 285 | |
|
286 | 286 | def __setitem__(self, key, value): |
|
287 |
if not isinstance(key, |
|
|
288 | raise TypeError("setitem: manifest keys must be a string.") | |
|
287 | if not isinstance(key, bytes): | |
|
288 | raise TypeError("setitem: manifest keys must be a byte string.") | |
|
289 | 289 | if not isinstance(value, tuple) or len(value) != 2: |
|
290 | 290 | raise TypeError("Manifest values must be a tuple of (node, flags).") |
|
291 | 291 | hashval = value[0] |
|
292 |
if not isinstance(hashval, |
|
|
293 | raise TypeError("node must be a 20-byte string") | |
|
292 | if not isinstance(hashval, bytes) or not 20 <= len(hashval) <= 22: | |
|
293 | raise TypeError("node must be a 20-byte byte string") | |
|
294 | 294 | flags = value[1] |
|
295 | 295 | if len(hashval) == 22: |
|
296 | 296 | hashval = hashval[:-1] |
|
297 |
if not isinstance(flags, |
|
|
297 | if not isinstance(flags, bytes) or len(flags) > 1: | |
|
298 | 298 | raise TypeError("flags must a 0 or 1 byte string, got %r", flags) |
|
299 | 299 | needle, found = self.bsearch2(key) |
|
300 | 300 | if found: |
General Comments 0
You need to be logged in to leave comments.
Login now