[Python-Dev] [PEP466] SSLSockets, and sockets, _socketobjects oh my!

2014年7月22日 14:05:25 -0700

Hi all,
I've been happily working on the SSL module backports for Python2 (pursuant to
PEP466), and I've hit something of a snag:
In python3, the SSLSocket keeps a weak reference to the underlying socket,
rather than a strong reference, as Python2 uses.
Unfortunately, due to the way sockets work in Python2, this doesn't work:
On Python2, _socketobject composes around _real_socket from the _socket module,
whereas on Python3, it subclasses _socket.socket. Since you now have a Python-
level class, you can weak reference it.
The question is:
a) Should we backport weak referencing _socket.sockets (changing the structure
 of the module seems overly invasive, albeit completely backwards
 compatible)?
b) Does anyone know why weak references are used in the first place? The commit
 message just alludes to fixing a leak with no reference to an issue.
Anyone who's interested in the state of the branch can see it at:
github.com/alex/cpython on the backport-ssl branch. Note that many many tests
are still failing, and you'll need to apply the patch from
http://bugs.python.org/issue22023 to get it to work.
Thanks,
Alex
PS: Any help in getting http://bugs.python.org/issue22023 landed which be very
much appreciated.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to