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 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 <1461526243.35.0.305938533284.issue26800@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
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: <1461526243.35.0.305938533284.issue26800@psf.upfronthosting.co.za>
2016-04-24 19:30:43vstinnerlinkissue26800 messages
2016-04-24 19:30:43vstinnercreate