diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-04 15:48:06 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-04 15:48:06 (GMT) |
commit | a47b75b0a0e2fc7ee396bb317cd601ecec96f923 (patch) | |
tree | 20f180ed64af3ae1ccba9d8adddf6089d069f56b | |
parent | aee643b01fe4cb3993efcc2e06639e5cbf684c94 (diff) | |
download | cpython-a47b75b0a0e2fc7ee396bb317cd601ecec96f923.zip cpython-a47b75b0a0e2fc7ee396bb317cd601ecec96f923.tar.gz cpython-a47b75b0a0e2fc7ee396bb317cd601ecec96f923.tar.bz2 |
socket.ioctl is only available on Windows
-rw-r--r-- | Lib/socket.py | 5 | ||||
-rw-r--r-- | Lib/test/test_socket.py | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index 7ce2869..6b4b743 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -141,7 +141,10 @@ _socketmethods = ( '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',) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 3e2d04c..8f69a40 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -9,6 +9,7 @@ import time import thread, threading import Queue import sys +import os import array from weakref import proxy import signal @@ -500,6 +501,15 @@ class GeneralModuleTests(unittest.TestCase): 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'): |