STINNER Victor added the comment:

I'm really sceptical that anyone really use bytearray for filenames in Python. 
I'm quite sure that most functions fail with bytearray. Do you have an example 
of application using bytearray? What's the point of using bytearray? To limit 
memory copy and optimize the memory usage?

The two most common functions for filenames are os.path.join() and open(). I 
just tried:

>>> os.path.join(bytearray(b"a"), b"b")
Traceback (most recent call last):
  ...
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

>>> open(bytearray(b"/etc/issue"))
Traceback (most recent call last):
  ...
TypeError: invalid file: bytearray(b'/etc/issue')

Hum, so bytearray are not accepted for open() nor os.path.join(), right?

----------

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

Reply via email to