Commit 11cdf9fc authored by Tim Peters's avatar Tim Peters

scan(): If the status byte has an unexpected value, show it in hex

rather than as a (probably) unprintable character.
parent f61317ae
...@@ -572,7 +572,7 @@ OBJECT_HEADER_SIZE = 1 + 4 + 16 ...@@ -572,7 +572,7 @@ OBJECT_HEADER_SIZE = 1 + 4 + 16
# disk. # disk.
class FileCache(object): class FileCache(object):
def __init__(self, maxsize, fpath, parent, reuse=True): def __init__(self, maxsize, fpath, parent, reuse=True):
# Maximum total of object sizes we keep in cache. # Maximum total of object sizes we keep in cache.
self.maxsize = maxsize self.maxsize = maxsize
...@@ -624,7 +624,7 @@ class FileCache(object): ...@@ -624,7 +624,7 @@ class FileCache(object):
else: else:
self.new = False self.new = False
self.f = None self.f = None
# Statistics: _n_adds, _n_added_bytes, # Statistics: _n_adds, _n_added_bytes,
# _n_evicts, _n_evicted_bytes # _n_evicts, _n_evicted_bytes
self.clearStats() self.clearStats()
...@@ -661,7 +661,7 @@ class FileCache(object): ...@@ -661,7 +661,7 @@ class FileCache(object):
elif status in '1234': elif status in '1234':
size = int(status) size = int(status)
else: else:
assert 0, status assert 0, hex(ord(status))
self.filemap[ofs] = size, ent self.filemap[ofs] = size, ent
if ent is None and size > max_free_size: if ent is None and size > max_free_size:
...@@ -839,7 +839,7 @@ class FileCache(object): ...@@ -839,7 +839,7 @@ class FileCache(object):
# disk where the object was stored. We need to load the # disk where the object was stored. We need to load the
# header to update the in-memory data structures held by # header to update the in-memory data structures held by
# ClientCache. # ClientCache.
# XXX Or we could just keep the header in memory at all times. # XXX Or we could just keep the header in memory at all times.
e = self.key2entry.get(key) e = self.key2entry.get(key)
...@@ -861,11 +861,11 @@ class FileCache(object): ...@@ -861,11 +861,11 @@ class FileCache(object):
# This method should be called when the object header is modified. # This method should be called when the object header is modified.
def update(self, obj): def update(self, obj):
e = self.key2entry[obj.key] e = self.key2entry[obj.key]
self.f.seek(e.offset + OBJECT_HEADER_SIZE) self.f.seek(e.offset + OBJECT_HEADER_SIZE)
obj.serialize_header(self.f) obj.serialize_header(self.f)
def settid(self, tid): def settid(self, tid):
if self.tid is not None: if self.tid is not None:
if tid < self.tid: if tid < self.tid:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment