New submission from Serhiy Storchaka:

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).

----------
components: Library (Lib)
files: posixpath_join_bytearray-3.4.diff
keywords: patch
messages: 223654
nosy: hynek, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: posixpath.join() and bytearray
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36028/posixpath_join_bytearray-3.4.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22034>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to