summaryrefslogtreecommitdiff
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-03-20 23:56:36 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2011-03-20 23:56:36 +0100
commit6d58d64919bb12e05fa4bf3a34909650c695cff6 (patch)
treea8b7d7915779a6cc30f7f6a9d69191d7bd34a002 /Lib/test/test_socket.py
parentb938bcd211bfcab13be38200a2f59947691118bb (diff)
downloadcpython-git-6d58d64919bb12e05fa4bf3a34909650c695cff6.tar.gz
Issue #11127: Raise a TypeError when trying to pickle a socket object.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index d761a73f2f..8b23ae9924 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -18,6 +18,7 @@ import contextlib
from weakref import proxy
import signal
import math
+import pickle
try:
import fcntl
except ImportError:
@@ -764,6 +765,12 @@ class GeneralModuleTests(unittest.TestCase):
fp.close()
self.assertEqual(repr(fp), "<_io.BufferedReader name=-1>")
+ def test_pickle(self):
+ sock = socket.socket()
+ with sock:
+ for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
+ self.assertRaises(TypeError, pickle.dumps, sock, protocol)
+
@unittest.skipUnless(thread, 'Threading required for this test.')
class BasicTCPTest(SocketConnectedTest):