[issue7561] Filename-taking functions in posix segfault when called with a bytearray arg.
Martin v. Löwis
report at bugs.python.org
Tue Dec 22 20:47:28 CET 2009
Martin v. Löwis <martin at v.loewis.de> added the comment:
I doubt that buffers (including bytearray) are as useful in Python for
storing file names as they are in C.
Typically, when creating a buffer, you allocate some maximum size (in C:
MAXPATH or some such), and then you fill the buffer, and null-terminate.
In Python, you can't null-terminate; instead, the buffer must have the
right size already. So I wonder: where would you get a bytearray from
that has exactly the right size for a file name that you want to access
(and where do you get the file name from)?
If it is IAGNI, then: practicality beats purity - just because we
*could* support arbitrary byte areas, it doesn't mean we should.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7561>
_______________________________________
More information about the Python-bugs-list
mailing list