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