New submission from Takeshi Sone:
socket() returns socket object wrapped by Python code, but fromfd() and
socketpair() return raw object. This results in behaviour differences
between sockets.
Attached patch fixes it.
----------
components: Library (Lib)
files: fromfd_sockpair.patch
messages: 58172
nosy: ts1
severity: normal
status: open
title: fromfd() and socketpair() should return wrapped sockets
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6
Added file: http://bugs.python.org/file8870/fromfd_sockpair.patch
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1552>
__________________________________
Index: Lib/socket.py
===================================================================
--- Lib/socket.py (revision 59313)
+++ Lib/socket.py (working copy)
@@ -213,6 +213,27 @@
socket = SocketType = _socketobject
+
+try:
+ _real_fromfd = fromfd
+except NameError:
+ pass
+else:
+ def fromfd(*args):
+ return _socketobject(_sock=_real_fromfd(*args))
+ fromfd.__doc__ = _real_fromfd.__doc__
+
+try:
+ _real_socketpair = socketpair
+except NameError:
+ pass
+else:
+ def socketpair(*args):
+ a, b = _real_socketpair(*args)
+ return _socketobject(_sock=a), _socketobject(_sock=b)
+ socketpair.__doc__ = _real_socketpair.__doc__
+
+
class _fileobject(object):
"""Faux file object attached to a socket object."""
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com