bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (GH-17160) (GH-17249)
(cherry picked from commit fe75b62575bcfdf1c39be71c1e50257832a596db)
Co-authored-by: Tomás Farías <tomasfariassantana@gmail.com>
diff --git a/Lib/genericpath.py b/Lib/genericpath.py
index db11f67..ce36451 100644
--- a/Lib/genericpath.py
+++ b/Lib/genericpath.py
@@ -149,7 +149,7 @@
elif isinstance(s, bytes):
hasbytes = True
else:
- raise TypeError('%s() argument must be str or bytes, not %r' %
- (funcname, s.__class__.__name__)) from None
+ raise TypeError(f'{funcname}() argument must be str, bytes, or '
+ f'os.PathLike object, not {s.__class__.__name__!r}') from None
if hasstr and hasbytes:
raise TypeError("Can't mix strings and bytes in path components") from None