Skip to content

Commit

Permalink
add assert for DelayedBase in parse_python (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackTemaki authored May 16, 2022
1 parent 22b4514 commit ac59540
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions returnn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def __init__(
self.python_epilog_hash = self.__parse_python(python_epilog)
else:
self.python_epilog_hash = python_epilog
self.hash_full_python_code = hash_full_python_code
self.sort_config = sort_config
self.pprint_kwargs = pprint_kwargs or {}
if sys.version_info[:2] >= (3, 8):
Expand Down Expand Up @@ -275,6 +276,10 @@ def __parse_python(self, code, name=None):
if isinstance(code, str):
return code
if isinstance(code, DelayedBase):
assert self.hash_full_python_code is False, (
"DelayedBase object can not be passed if `hash_full_python_code` is set, "
"as this will cause breaking hashes"
)
return self.__parse_python(code.get())
if isinstance(code, (tuple, list)):
return "\n".join(self.__parse_python(c) for c in code)
Expand Down

0 comments on commit ac59540

Please sign in to comment.