[issue7561] Filename-taking functions in posix segfault when called with a bytearray arg.

Sebastian Hagen report at bugs.python.org
Tue Dec 22 19:20:41 CET 2009


Sebastian Hagen <sh_pybugs at memespace.net> added the comment:

I've glanced at some of the other PyByteArray_AS_STRING() (and
PyByteArray_AsStr(), which inherits this behaviour) uses in the stdlib.
By far the heaviest user is bytearrayobject.c; aside from that, there's
by my count only 24 uses in current trunk. I haven't looked at all of
them in detail, but the ones I have looked at all seem to ensure that
the possible NULL retvals don't cause them problems.

Given that, and considering that bytearray itself uses it for all kinds
of operations, I'd be rather reluctant to add any additional overhead to
this macro absent some authoritative statement that the current
behaviour is bad. We'd definitely get better performance by just having
posixmodule.c pay attention to the retval it gets. [Yes, this is
probably premature optimization; but it's not as if fixing posixmodule.c
takes any massive changes either, so I'm not too worried about
additional code complexity in this particular case.]

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7561>
_______________________________________


More information about the Python-bugs-list mailing list