classification
Title: socket.detach doesn't mark socket._closed
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: anacrolix, giampaolo.rodola, haypo, jcea, pitrou, python-dev, stutzbach
Priority: normal Keywords: patch

Created on 2012-01-26 12:57 by anacrolix, last changed 2012-03-31 23:09 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
socket-detach-mark-closed.patch anacrolix, 2012-01-26 12:57
Messages (5)
msg152005 - (view) Author: Matt Joiner (anacrolix) Date: 2012-01-26 12:57
socket.socket.detach doesn't mark the socket._closed flag. The flag is specific to the Python wrapper, so the fix is put there. Test included.
msg152247 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-01-29 17:23
> socket.socket.detach doesn't mark the socket._closed flag.

Well, does it have to? It's only an internal detail, it's not exposed as a public API.
msg155912 - (view) Author: Matt Joiner (anacrolix) Date: 2012-03-15 17:08
Yes it should.

A cursory glance shows that __repr__ returns incorrect if _closed is not marked, and an unnecessary mop-up call to socket.close is avoided.
msg157236 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-31 23:08
New changeset 3a220feafa15 by Antoine Pitrou in branch '3.2':
Issue #13872: socket.detach() now marks the socket closed (as mirrored in the socket repr()).
http://hg.python.org/cpython/rev/3a220feafa15

New changeset d2f0c3eb1eed by Antoine Pitrou in branch 'default':
Issue #13872: socket.detach() now marks the socket closed (as mirrored in the socket repr()).
http://hg.python.org/cpython/rev/d2f0c3eb1eed
msg157237 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-03-31 23:09
Thank you Matt. I've now committed the patch in relevant versions.
History
Date User Action Args
2012-03-31 23:09:03pitrousetstatus: open -> closed
versions: - Python 2.6, Python 3.1, Python 2.7
messages: + msg157237

resolution: fixed
stage: resolved
2012-03-31 23:08:02python-devsetnosy: + python-dev
messages: + msg157236
2012-03-15 17:08:54anacrolixsetnosy: + haypo, giampaolo.rodola, stutzbach
messages: + msg155912
2012-02-01 20:30:36jceasetnosy: + jcea
2012-01-29 17:23:15pitrousetmessages: + msg152247
2012-01-29 15:37:50neologixsetnosy: + pitrou
2012-01-26 12:57:31anacrolixcreate