Skip to content

Commit

Permalink
sis_hash_helper, do not pickle from __main__ (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz authored Jul 31, 2023
1 parent 7698b7e commit 50f1924
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sisyphus/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ def sis_hash_helper(obj):
# Not a nice way to check if the given function is a lambda function, but the best I found
# assert not isinstance(lambda m: m, LambdaType) is true for all functions
assert obj.__name__ != '<lambda>', "Hashing of lambda functions is not supported"
assert obj.__module__ != "__main__", "Hashing of functions defined in __main__ is not supported"
byte_list.append(sis_hash_helper((obj.__module__, obj.__qualname__)))
elif isclass(obj):
assert obj.__module__ != "__main__", "Hashing of classes defined in __main__ is not supported"
byte_list.append(sis_hash_helper((obj.__module__, obj.__qualname__)))
elif hasattr(obj, '_sis_hash'):
# sis job or path object
Expand Down

0 comments on commit 50f1924

Please sign in to comment.