bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (GH-17160) (GH-17249)
(cherry picked from commit fe75b62575
)
Co-authored-by: Tomás Farías <tomasfariassantana@gmail.com>
This commit is contained in:
parent
bec7015dcc
commit
b5bb3b637c
|
@ -149,7 +149,7 @@ def _check_arg_types(funcname, *args):
|
||||||
elif isinstance(s, bytes):
|
elif isinstance(s, bytes):
|
||||||
hasbytes = True
|
hasbytes = True
|
||||||
else:
|
else:
|
||||||
raise TypeError('%s() argument must be str or bytes, not %r' %
|
raise TypeError(f'{funcname}() argument must be str, bytes, or '
|
||||||
(funcname, s.__class__.__name__)) from None
|
f'os.PathLike object, not {s.__class__.__name__!r}') from None
|
||||||
if hasstr and hasbytes:
|
if hasstr and hasbytes:
|
||||||
raise TypeError("Can't mix strings and bytes in path components") from None
|
raise TypeError("Can't mix strings and bytes in path components") from None
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Update :exc:`TypeError` messages for :meth:`os.path.join` to include :class:`os.PathLike` objects as acceptable input types.
|
Loading…
Reference in New Issue