bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (#17160)
This commit is contained in:
parent
02b8051a5e
commit
fe75b62575
|
@ -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