Skip to content

Commit da96563

Browse files
author
tanbro
committed
fixing: #48
ValueError raised when maxpath in sequence params is not an integer string
1 parent 1d1ec12 commit da96563

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/yaml_include/constructor.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,10 @@ def load(self, loader_type: Type[Union[_Loader, _CLoader]], data: Data) -> Any:
390390
glob_fn = lambda: self.fs.glob(urlpath, *pos_args) # noqa: E731
391391
else:
392392
# special for maxdepth, because PyYAML sometimes treat number as string for constructor's parameter
393-
maxdepth = int(glob_params)
393+
try:
394+
maxdepth = int(glob_params)
395+
except ValueError:
396+
maxdepth = None
394397
glob_fn = lambda: self.fs.glob(urlpath, maxdepth=maxdepth) # noqa: E731
395398

396399
if open_params is None:

0 commit comments

Comments
 (0)