[Python-checkins] r59721 - in python/trunk/Lib: socket.py test/test_socket.py

christian.heimes python-checkins at python.org
Fri Jan 4 16:48:06 CET 2008


Author: christian.heimes
Date: Fri Jan  4 16:48:06 2008
New Revision: 59721

Modified:
   python/trunk/Lib/socket.py
   python/trunk/Lib/test/test_socket.py
Log:
socket.ioctl is only available on Windows

Modified: python/trunk/Lib/socket.py
==============================================================================
--- python/trunk/Lib/socket.py	(original)
+++ python/trunk/Lib/socket.py	Fri Jan  4 16:48:06 2008
@@ -141,7 +141,10 @@
     'bind', 'connect', 'connect_ex', 'fileno', 'listen',
     'getpeername', 'getsockname', 'getsockopt', 'setsockopt',
     'sendall', 'setblocking',
-    'settimeout', 'gettimeout', 'shutdown', 'ioctl')
+    'settimeout', 'gettimeout', 'shutdown')
+
+if os.name == "nt":
+    _socketmethods = _socketmethods + ('ioctl',)
 
 if sys.platform == "riscos":
     _socketmethods = _socketmethods + ('sleeptaskw',)

Modified: python/trunk/Lib/test/test_socket.py
==============================================================================
--- python/trunk/Lib/test/test_socket.py	(original)
+++ python/trunk/Lib/test/test_socket.py	Fri Jan  4 16:48:06 2008
@@ -9,6 +9,7 @@
 import thread, threading
 import Queue
 import sys
+import os
 import array
 from weakref import proxy
 import signal
@@ -500,6 +501,15 @@
         self.assertEqual(sock.proto, 0)
         sock.close()
 
+    def test_sock_ioctl(self):
+        if os.name != "nt":
+            return
+        self.assert_(hasattr(socket.socket, 'ioctl'))
+        self.assert_(hasattr(socket, 'SIO_RCVALL'))
+        self.assert_(hasattr(socket, 'RCVALL_ON'))
+        self.assert_(hasattr(socket, 'RCVALL_OFF'))
+
+
 class BasicTCPTest(SocketConnectedTest):
 
     def __init__(self, methodName='runTest'):


More information about the Python-checkins mailing list