[issue15758] FileIO.readall() has worst case O(n^2) complexity

Antoine Pitrou report at bugs.python.org
Thu Aug 23 16:50:11 CEST 2012


Antoine Pitrou added the comment:

> Here is the patch (with the old ones removed).
> 
> Note that the old code mishandled the case where _PyBytes_Resize()
> failed by assuming that the old bytes object would still be valid.
> 
> I have assumed that stream psuedo-files will never claim to have a
> size greater than zero.  The code will still work if this assumption
> is false.

I haven't measured under Windows, but this looks ok to me.

----------

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


More information about the Python-bugs-list mailing list