This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Some SocketIO methods can succeed after close()
Type: behavior Stage: resolved
Components: IO, Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, eng793, hynek, pitrou, python-dev, stutzbach
Priority: normal Keywords: patch

Created on 2012-09-01 19:20 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
socket.patch eng793, 2012-09-05 17:57 patch review
socket.patch eng793, 2012-09-08 23:51 patch review
Messages (6)
msg169666 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-09-01 19:20
>>> import socket
>>> s = socket.socket()
>>> f = s.makefile("rb", buffering=0)
>>> f
<socket.SocketIO object at 0x7f2f323cd790>
>>> f.close()
>>> f.writable()
False
>>> f.readable()
False
msg169883 - (view) Author: Alessandro Moura (eng793) * Date: 2012-09-05 17:57
This patch fixes the problem, making those methods raise a ValueError exception after close.

I also added one test case for this issue.
msg170057 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-09-08 17:16
Actually, I've found a couple of issues with the patch:
- it doesn't address seekable(); seekable() should also raise ValueError
- the test should be done with makefile(..., buffering=0), so that SocketIO is actually tested, rather than the buffered object wrapping it
msg170068 - (view) Author: Alessandro Moura (eng793) * Date: 2012-09-08 23:51
Fixed seekable(), and amended tests; see patch.
msg170478 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-09-14 15:34
New changeset fad797916266 by Antoine Pitrou in branch '3.2':
Issue #15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
http://hg.python.org/cpython/rev/fad797916266

New changeset 3b0e20f71d8a by Antoine Pitrou in branch 'default':
Issue #15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
http://hg.python.org/cpython/rev/3b0e20f71d8a
msg170479 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-09-14 15:34
Ok, I've committed the patch. Thanks Alessandro!
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60046
2012-09-14 15:34:51pitrousetstatus: open -> closed
resolution: fixed
messages: + msg170479

stage: resolved
2012-09-14 15:34:17python-devsetnosy: + python-dev
messages: + msg170478
2012-09-08 23:51:06eng793setfiles: + socket.patch

messages: + msg170068
2012-09-08 17:16:03pitrousetmessages: + msg170057
2012-09-05 17:57:55eng793setfiles: + socket.patch

nosy: + eng793
messages: + msg169883

keywords: + patch
2012-09-01 19:20:12pitroucreate