[entropy.cache] handle TypeError exceptions when copy.deepcopy() raises it
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
entropy.client.interfaces.cache mixin methods)
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
from entropy.core import Singleton
|
||||
from entropy.misc import TimeScheduled, Lifo
|
||||
import time
|
||||
@@ -219,7 +219,14 @@ class EntropyCacher(Singleton):
|
||||
return
|
||||
if async:
|
||||
with self.__cache_lock:
|
||||
self.__cache_buffer.push((key, self.__copy_obj(data),))
|
||||
try:
|
||||
self.__cache_buffer.push((key, self.__copy_obj(data),))
|
||||
except TypeError:
|
||||
# sometimes, very rarely, copy.deepcopy() is unable
|
||||
# to properly copy an object (blame Python bug)
|
||||
sys.stdout.write("!!! cannot cache object with key %s\n" % (
|
||||
key,))
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
self.dumpTools.dumpobj(key, data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user