Skip to content

Commit 4b9c022

Browse files
authored
Fix AttributeError in field_parsing.py (#251)
Signed-off-by: Fabrice Normandin <normandf@mila.quebec>
1 parent 68e16b2 commit 4b9c022

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

simple_parsing/wrappers/field_parsing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ def _try_functions(val: Any) -> Union[T, Any]:
172172
f"Couldn't parse value {val}, returning the value as-is. (exceptions: {exceptions})"
173173
)
174174

175-
_try_functions.__name__ = "Try<" + " and ".join(str(func.__name__) for func in funcs) + ">"
175+
_try_functions.__name__ = (
176+
"Try<" + " and ".join(str(getattr(func, "__name__", func)) for func in funcs) + ">"
177+
)
176178
return _try_functions
177179

178180

0 commit comments

Comments
 (0)