This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients hynek, ncoghlan, serhiy.storchaka
Date 2014-07-22.09:33:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406021609.78.0.443791365349.issue22034@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2014-07-22 09:33:29serhiy.storchakasetrecipients: + serhiy.storchaka, ncoghlan, hynek
2014-07-22 09:33:29serhiy.storchakasetmessageid: <1406021609.78.0.443791365349.issue22034@psf.upfronthosting.co.za>
2014-07-22 09:33:29serhiy.storchakalinkissue22034 messages
2014-07-22 09:33:29serhiy.storchakacreate