--- a/qmsk/net/socket/socket.pyx Sun Aug 16 23:32:00 2009 +0300
+++ b/qmsk/net/socket/socket.pyx Sun Aug 16 23:45:43 2009 +0300
@@ -153,7 +153,7 @@
try :
# prep the new socket
- sock_obj = socket(sock_fd)
+ sock_obj = socket(fd=sock_fd)
except :
# XXX: don't leak the socket fd? How does socket.__init__ handle this?
@@ -350,9 +350,14 @@
if ret < 0 :
raise_errno('recv')
+
+ # truncate to correct length
+ # XXX: refcounts?
+ cdef py.PyObject *str_obj = <py.PyObject *> str
+
+ py._PyString_Resize(&str_obj, ret)
- # XXX: figure out how to call _PyString_Resize
- return str[:ret]
+ return <object> str_obj
def recvfrom (self, size_t len, int flags = 0) :
"""