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

STINNER Victor report at bugs.python.org
Wed Mar 18 02:59:34 CET 2009


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I wrote a short script to test TextIOWrapper.readline() with 32 
threads. After 5 seconds, I found this issue in Python trunk (2.7):

Exception in thread Thread-26:
Traceback (most recent call last):
  File "/home/SHARE/SVN/python-trunk/Lib/threading.py", line 522, in 
__bootstrap_inner
    self.run()
  File "/home/haypo/crash_textiowrapper.py", line 15, in run
    line = self.file.readline()
  File "/home/SHARE/SVN/python-trunk/Lib/io.py", line 1835, in 
readline
    self._rewind_decoded_chars(len(line) - endpos)
  File "/home/SHARE/SVN/python-trunk/Lib/io.py", line 1541, in 
_rewind_decoded_chars
    raise AssertionError("rewind decoded_chars out of bounds")
AssertionError: rewind decoded_chars out of bounds

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

----------
Added file: http://bugs.python.org/file13361/crash_textiowrapper.py

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


More information about the Python-bugs-list mailing list