[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: I have now committed the patch. Thank you again! -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker __

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 524931e5aebf by Antoine Pitrou in branch '3.2': Issue #15841: The readable(), writable() and seekable() methods of BytesIO http://hg.python.org/cpython/rev/524931e5aebf New changeset fcf097cb5f6b by Antoine Pitrou in branch 'default': Issue #15841:

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-05 Thread Alessandro Moura
Alessandro Moura added the comment: I just emailed my contributor's agreement. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: Alessandro, have you already signed a contributor agreement so that your patch can be integrated? If not, you'll find the instructions at http://www.python.org/psf/contrib/ Thank you! -- ___ Python tracker

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-04 Thread Alessandro Moura
Alessandro Moura added the comment: Thanks. Here is the amended patch with your suggestions implemented. -- Added file: http://bugs.python.org/file27117/memoryio.patch ___ Python tracker ___

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: A couple of nits about the docstrings: +PyDoc_STRVAR(stringio_seekable_doc, +"seekable() -> Bool. Returns True if IO object can be seeked."); First, "bool" should be lowercase. Also, in seekable(), "IO object" should be "the IO object". Otherwise, looks fine t

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Alessandro Moura
Alessandro Moura added the comment: Sorry, I should have seen the related issue (or just read the docs :)). Here is the patch fixing these issues, implementing the behaviour stated in the docs (raising ValueError after close). The tests revealed that the _pyio module also needed fixing, and th

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, there's a misunderstanding. The methods should raise ValueError when the object has been closed. See issue15840 for reference. -- ___ Python tracker __

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Alessandro Moura
Alessandro Moura added the comment: Here is the patch fixing the issue in both StringIO and BytesIO. In both cases, the problem is that in their respective c files, these methods always returned true, without testing whether the file was closed. Is this a recent rewrite? I am surprised this di

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Alessandro Moura
Alessandro Moura added the comment: This also happens for the writable() and seekable() methods. The problem is that those methods do not check whether the buffers have been closed in stringio.c. This is fixed in the attached patch for StringIO. BytesIO should be the same, but bytesio.c is str

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-01 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +benjamin.peterson, hynek, stutzbach ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-01 Thread Antoine Pitrou
New submission from Antoine Pitrou: >>> f = io.StringIO() >>> f.close() >>> f.readable() True >>> f.read() Traceback (most recent call last): File "", line 1, in ValueError: I/O operation on closed file. >>> f = io.BytesIO() >>> f.close() >>> f.readable() True >>> f.read() Traceback (most rec