summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r--Lib/posixpath.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 0aa53fe..f08c931 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -82,12 +82,13 @@ def join(a, *p):
path += b
else:
path += sep + b
- except TypeError:
- if all(isinstance(s, (str, bytes)) for s in (a,) + p):
- # Must have a mixture of text and binary data
- raise TypeError("Can't mix strings and bytes in path "
- "components") from None
- raise
+ except (TypeError, AttributeError):
+ for s in (a,) + p:
+ if not isinstance(s, (str, bytes)):
+ raise TypeError('join() argument must be str or bytes, not %r' %
+ s.__class__.__name__) from None
+ # Must have a mixture of text and binary data
+ raise TypeError("Can't mix strings and bytes in path components") from None
return path