提交 381f171f authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Removed unused force_fresh parameter in ModuleCache:

This parameter has been made useless since cbb136aad3a8 (July 2009), so it seems likely we do not need it.
上级 a6beb073
...@@ -419,16 +419,11 @@ class ModuleCache(object): ...@@ -419,16 +419,11 @@ class ModuleCache(object):
"""A list with counters for the number of hits, loads, compiles issued by module_from_key() """A list with counters for the number of hits, loads, compiles issued by module_from_key()
""" """
force_fresh = False
"""True -> Ignore previously-compiled modules
"""
loaded_key_pkl = set() loaded_key_pkl = set()
"""set of all key.pkl files that have been loaded. """set of all key.pkl files that have been loaded.
""" """
def __init__(self, dirname, force_fresh=None, check_for_broken_eq=True, def __init__(self, dirname, check_for_broken_eq=True, do_refresh=True):
do_refresh=True):
""" """
:param check_for_broken_eq: A bad __eq__ implementation can break this :param check_for_broken_eq: A bad __eq__ implementation can break this
cache mechanism. This option turns on a not-too-expensive sanity check cache mechanism. This option turns on a not-too-expensive sanity check
...@@ -442,9 +437,6 @@ class ModuleCache(object): ...@@ -442,9 +437,6 @@ class ModuleCache(object):
self.entry_from_key = dict(self.entry_from_key) self.entry_from_key = dict(self.entry_from_key)
self.module_hash_to_key_data = dict(self.module_hash_to_key_data) self.module_hash_to_key_data = dict(self.module_hash_to_key_data)
self.stats = [0, 0, 0] self.stats = [0, 0, 0]
if force_fresh is not None:
# TODO Where is / was `force_fresh` used?
self.force_fresh = force_fresh
self.check_for_broken_eq = check_for_broken_eq self.check_for_broken_eq = check_for_broken_eq
self.loaded_key_pkl = set() self.loaded_key_pkl = set()
self.time_spent_in_check_key = 0 self.time_spent_in_check_key = 0
...@@ -1125,7 +1117,7 @@ def _rmtree(parent, ignore_nocleanup=False, msg='', level='debug', ...@@ -1125,7 +1117,7 @@ def _rmtree(parent, ignore_nocleanup=False, msg='', level='debug',
warning('Failed to remove or mark cache directory %s for removal' % parent, ee) warning('Failed to remove or mark cache directory %s for removal' % parent, ee)
_module_cache = None _module_cache = None
def get_module_cache(dirname, force_fresh=None, init_args=None): def get_module_cache(dirname, init_args=None):
""" """
:param init_args: If not None, the (k, v) pairs in this dictionary will :param init_args: If not None, the (k, v) pairs in this dictionary will
be forwarded to the ModuleCache constructor as keyword arguments. be forwarded to the ModuleCache constructor as keyword arguments.
...@@ -1134,8 +1126,7 @@ def get_module_cache(dirname, force_fresh=None, init_args=None): ...@@ -1134,8 +1126,7 @@ def get_module_cache(dirname, force_fresh=None, init_args=None):
if init_args is None: if init_args is None:
init_args = {} init_args = {}
if _module_cache is None: if _module_cache is None:
_module_cache = ModuleCache(dirname, force_fresh=force_fresh, _module_cache = ModuleCache(dirname, **init_args)
**init_args)
atexit.register(_module_cache._on_atexit) atexit.register(_module_cache._on_atexit)
elif init_args: elif init_args:
warning('Ignoring init arguments for module cache because it was ' warning('Ignoring init arguments for module cache because it was '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论