Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function source code to hash #35

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cachier/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .pickle_core import _PickleCore
from .mongo_core import _MongoCore, RecalculationNeeded

import inspect

MAX_WORKERS_ENVAR_NAME = 'CACHIER_MAX_WORKERS'
DEFAULT_MAX_WORKERS = 8
Expand Down Expand Up @@ -148,7 +149,8 @@ def func_wrapper(*args, **kwds): # pylint: disable=C0111,R0911
_print = print
if ignore_cache:
return func(*args, **kwds)
key, entry = core.get_entry(args, kwds, hash_params)
code = {'source': inspect.getsource(func)}
key, entry = core.get_entry(args, {**kwds, **code}, hash_params)
if overwrite_cache:
return _calc_entry(core, key, func, args, kwds)
if entry is not None: # pylint: disable=R0101
Expand Down