[issue9647] os.confstr() does not handle value changing length between calls

David Watson report at bugs.python.org
Sat Oct 2 23:25:46 CEST 2010


David Watson <baikie at users.sourceforge.net> added the comment:

> If I understood correctly, you don't want the value to be truncated if the variable grows between the two calls to confstr(). Which behaviour would you expect? A Python exception?

A return size larger than the buffer is *supposed* to indicate
that the current value is larger than the supplied buffer, so I
would just expect it to reallocate the buffer, call confstr()
again and return the new value, unless it was known that such a
situation indicated an actual problem.

In other words, I would not expect it to do anything special.  I
didn't write the original patch the way I did in order to fix
this (potential) bug - it just seemed like the most natural way
to write the code.

----------

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


More information about the Python-bugs-list mailing list