Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3k Changeset: r48220:4c11bf0deece Date: 2011-10-18 22:45 +0200 http://bitbucket.org/pypy/pypy/changeset/4c11bf0deece/
Log: Make sockets really subclassable diff --git a/pypy/module/_socket/interp_socket.py b/pypy/module/_socket/interp_socket.py --- a/pypy/module/_socket/interp_socket.py +++ b/pypy/module/_socket/interp_socket.py @@ -415,13 +415,9 @@ @unwrap_spec(family=int, type=int, proto=int) def newsocket(space, w_subtype, family=AF_INET, type=SOCK_STREAM, proto=0): - # XXX If we want to support subclassing the socket type we will need - # something along these lines. But allocate_instance is only defined - # on the standard object space, so this is not really correct. - #sock = space.allocate_instance(W_RSocket, w_subtype) - #Socket.__init__(sock, space, fd, family, type, proto) + sock = space.allocate_instance(W_RSocket, w_subtype) try: - sock = W_RSocket(family, type, proto) + W_RSocket.__init__(sock, family, type, proto) except SocketError, e: raise converted_error(space, e) return space.wrap(sock) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit