[issue1751] Fast BytesIO implementation + misc changes

Alexandre Vassalotti report at bugs.python.org
Mon Jan 7 17:19:14 CET 2008


Alexandre Vassalotti added the comment:

So, here's one big patch. I have updated the behavior of close(), so that 

> The profile tests often fail when io.py changes because they happen to
> depend on "golden output" which includes line numbers of code in io.py
> that happens to be traced during the test. 

Yes, I knew that. But, how can I fix the test so that it passes even if
_bytesio is not available?

Oh, one more thing. In the misc fixes for io.py, I added a checkClosed
in IOBase.readline(). As a side-effect, this make __next__ raises a
ValueError, instead of StopIteration. Is that correct?  

>>> f = open("load.py")
[45681 refs]
>>> next(f)
'import sys\n'
[45700 refs]
>>> f.close()
[45703 refs]
>>> next(f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alex/src/python.org/py3k/Lib/io.py", line 1440, in __next__
    line = self.readline()
  File "/home/alex/src/python.org/py3k/Lib/io.py", line 1449, in readline
    raise ValueError("read from closed file")
ValueError: read from closed file
[45703 refs]

Added file: http://bugs.python.org/file9096/bytesio+misc-fixes.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1751>
__________________________________


More information about the Python-bugs-list mailing list