Author: Alex Gaynor <alex.gay...@gmail.com>
Branch: 
Changeset: r69996:f777f3fcf74a
Date: 2014-03-16 20:21 -0700
http://bitbucket.org/pypy/pypy/changeset/f777f3fcf74a/

Log:    Support creating subclasses of _socket (who knows why)

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
@@ -536,12 +536,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:
+        W_RSocket.__init__(sock, family, type, proto)
         sock = W_RSocket(family, type, proto)
     except SocketError, e:
         raise converted_error(space, e)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to