From 19afbc2105d0ddd0027658e564a2c49d373fa2a2 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 2 Dec 2021 19:32:25 -0800 Subject: [PATCH] Enforce with_child basename is str. --- voussoirkit/pathclass.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index 6135375..b71e52f 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -466,6 +466,8 @@ class Path: yield from directory.walk() def with_child(self, basename, **spawn_kwargs): + if not isinstance(basename, str): + raise TypeError(f'basename must be {str}, not {type(basename)}.') parts = (*self._parts, basename) return Path(parts, **spawn_kwargs)