Enforce with_child basename is str.

This commit is contained in:
voussoir 2021-12-02 19:32:25 -08:00
parent e2fd04ccf1
commit 19afbc2105
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -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)