[issue5502] io-c: TextIOWrapper is faster than BufferedReader but not protected by a lock

Antoine Pitrou report at bugs.python.org
Wed Mar 18 11:35:39 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

> But it looks that py3k is stronger because it doesn't crash. Is it the 
> power of the GIL?

Yes, it is.
In theory, we needn't take the lock in all of BufferedReader.readline(),
only when calling external code which might itself release the GIL. In
practice, we didn't bother optimizing the lock-taking, for the sake of
simplicity. If the lock really accounts for a significant part of the
runtime cost, we can try to do better.

----------

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


More information about the Python-bugs-list mailing list