Skip to content

Commit

Permalink
revert common.get_all_parameters() to handle exception
Browse files Browse the repository at this point in the history
  • Loading branch information
runjerry committed Jan 17, 2024
1 parent dad503d commit ed5ac5d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion alf/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,13 @@ def get_all_parameters(obj):
# when called in a wrong context (e.g. Algorithm.experience_spec)
if isinstance(getattr(type(obj), name, None), property):
continue
attr = getattr(obj, name, None)
try:
attr = getattr(obj, name)
except:
# some attrbutes are property function, which may raise exception
# when called in a wrong context (e.g. Algorithm.experience_spec)
pass

if attr is None or id(attr) in memo:
continue
unprocessed.append((attr, path + name))
Expand Down

0 comments on commit ed5ac5d

Please sign in to comment.