21639: Make sure it is a mmap object before calling madvise
[arvados.git] / sdk / python / arvados / diskcache.py
index 2d85c1126623af9974ce892a79dcb5fc5472ce69..1e885c15e2146ea9a0c2cf67a1fb333617729138 100644 (file)
@@ -32,7 +32,7 @@ class DiskCacheSlot(object):
 
     def get(self):
         self.ready.wait()
-        if self.content is not None and len(self.content) > 0:
+        if isinstance(self.content, mmap.mmap):
             self.content.madvise(mmap.MADV_WILLNEED)
         return self.content