Message223654
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 "<stdin>", line 1, in <module>
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 issue15377 and misleading test which provoked it was added in issue15180.
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). |
|
Date |
User |
Action |
Args |
2014-07-22 09:33:29 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, ncoghlan, hynek |
2014-07-22 09:33:29 | serhiy.storchaka | set | messageid: <1406021609.78.0.443791365349.issue22034@psf.upfronthosting.co.za> |
2014-07-22 09:33:29 | serhiy.storchaka | link | issue22034 messages |
2014-07-22 09:33:29 | serhiy.storchaka | create | |
|