Use deepcopy in powerline.lib.config
This commit is contained in:
parent
4c426df5e0
commit
a202072292
|
@ -2,6 +2,7 @@
|
|||
|
||||
from powerline.lib.threaded import MultiRunnedThread
|
||||
from powerline.lib.file_watcher import create_file_watcher
|
||||
from copy import deepcopy
|
||||
|
||||
from threading import Event, Lock
|
||||
from collections import defaultdict
|
||||
|
@ -103,10 +104,10 @@ class ConfigLoader(MultiRunnedThread):
|
|||
def load(self, path):
|
||||
try:
|
||||
# No locks: GIL does what we need
|
||||
return self.loaded[path]
|
||||
return deepcopy(self.loaded[path])
|
||||
except KeyError:
|
||||
r = self._load(path)
|
||||
self.loaded[path] = r
|
||||
self.loaded[path] = deepcopy(r)
|
||||
return r
|
||||
|
||||
def update(self):
|
||||
|
@ -140,7 +141,7 @@ class ConfigLoader(MultiRunnedThread):
|
|||
self.missing.pop(key)
|
||||
for path in toload:
|
||||
try:
|
||||
self.loaded[path] = self._load(path)
|
||||
self.loaded[path] = deepcopy(self._load(path))
|
||||
except Exception as e:
|
||||
self.exception('Error while loading {0}: {1}', path, str(e))
|
||||
|
||||
|
|
Loading…
Reference in New Issue