STINNER Victor <victor.stin...@haypocalc.com> added the comment:

I spent two hours on this issue and here are some notes...

(1) SocketIO.close() have to call self._sock._decref_socketios() to 
allow the socket to call _real_close()

s = socket...
f = s.makefile()
f.close()  # only close the "file view"
s.close() <= close the socket here

(2) SocketIO.close() have to break its reference to allow the socket 
to be closed

s = socket...
f = s.makefile()
del s      # there is still one reference (f._sock)
f.close() <= the garbage collector will close the socket here

(3) operations on a closed SocketIO should be blocked

s = socket...
f = s.makefile()
f.close()
f.fileno() => error!

So issue3826_gps05.diff have two bugs:
 - point (1)
 - point (3): can be fixed by adding self._check_closed() (and so we 
don't need the local copy of fileno)

Added file: http://bugs.python.org/file12614/socket_real_close-5.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue3826>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to