Enforce with_child basename is str.
This commit is contained in:
parent
e2fd04ccf1
commit
19afbc2105
1 changed files with 2 additions and 0 deletions
|
@ -466,6 +466,8 @@ class Path:
|
||||||
yield from directory.walk()
|
yield from directory.walk()
|
||||||
|
|
||||||
def with_child(self, basename, **spawn_kwargs):
|
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)
|
parts = (*self._parts, basename)
|
||||||
return Path(parts, **spawn_kwargs)
|
return Path(parts, **spawn_kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue