LazyLoader deepcopy fix.

Don't keep module object as a field of LazyLoader that breaks
deepcopying.
This commit is contained in:
Dmitry Kuzmenko 2015-10-16 17:51:11 +03:00
parent 340229355c
commit 8c256c94f4

View file

@ -957,8 +957,9 @@ class LazyLoader(salt.utils.lazy.LazyDict):
if self.opts.get('cython_enable', True) is True:
try:
self.pyximport = __import__('pyximport') # pylint: disable=import-error
self.pyximport.install()
global pyximport
pyximport = __import__('pyximport') # pylint: disable=import-error
pyximport.install()
# add to suffix_map so file_mapping will pick it up
self.suffix_map['.pyx'] = tuple()
except ImportError:
@ -1093,7 +1094,8 @@ class LazyLoader(salt.utils.lazy.LazyDict):
try:
sys.path.append(os.path.dirname(fpath))
if suffix == '.pyx':
mod = self.pyximport.load_module(name, fpath, tempfile.gettempdir())
global pyximport
mod = pyximport.load_module(name, fpath, tempfile.gettempdir())
elif suffix == '.o':
top_mod = __import__(fpath, globals(), locals(), [])
comps = fpath.split('.')