Author vstinner
Recipients Ronan.Lamy, gvanrossum, larry, pitrou, pjenvey, serhiy.storchaka, vstinner
Date 2016-04-24.19:30:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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?
Date User Action Args
2016-04-24 19:30:43vstinnersetrecipients: + vstinner, gvanrossum, pitrou, larry, pjenvey, serhiy.storchaka, Ronan.Lamy
2016-04-24 19:30:43vstinnersetmessageid: <>
2016-04-24 19:30:43vstinnerlinkissue26800 messages
2016-04-24 19:30:43vstinnercreate