Issue 22034: posixpath.join() and bytearray (original) (raw)
posixpath.join() raises misleading exception in case when all arguments are bytearrays:
import posixpath posixpath.join(bytearray(b'foo'), bytearray(b'bar')) Traceback (most recent call last): File "", line 1, in File "/home/serhiy/py/cpython/Lib/posixpath.py", line 91, in join "components.") from None TypeError: Can't mix strings and bytes in path components.
This bug was introduced in and misleading test which provoked it was added in .
I proposed two patches. Patch for 3.4 only eliminates wrong specialcasing of bytearray (none of os.path methods work with bytearray). Patch for 3.5 also adds better error messages for wrong argument types of posixpath.join (of course we can apply it to 3.4 too).