From f820f55c3c337f0ecc7633fa397550f1f6ace4a3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 6 Dec 2018 23:00:39 +0200 Subject: [PATCH] [2.7] bpo-33023: Fix NotImplemented to NotImplementedError. (GH-10934). (GH-11001) (cherry picked from commit 42b1d6127bd8595522a78a75166ebb9fba74a6a2). (cherry picked from commit 7a2cf1e7d3bf300e98c702589d405734f4a8fcf8) Co-authored-by: Serhiy Storchaka --- Lib/ssl.py | 4 ++-- Lib/test/test_ssl.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py index 22d478b56871b48..087faf95ad99fd8 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -630,8 +630,8 @@ def context(self, ctx): self._sslobj.context = ctx def dup(self): - raise NotImplemented("Can't dup() %s instances" % - self.__class__.__name__) + raise NotImplementedError("Can't dup() %s instances" % + self.__class__.__name__) def _checkClosed(self, msg=None): # raise an exception here if you wish to check for spurious closes diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index dc14e22ad121ba0..e476031702537b6 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -341,6 +341,7 @@ def test_wrapped_unconnected(self): self.assertRaises(socket.error, ss.recvfrom_into, bytearray(b'x'), 1) self.assertRaises(socket.error, ss.send, b'x') self.assertRaises(socket.error, ss.sendto, b'x', ('0.0.0.0', 0)) + self.assertRaises(NotImplementedError, ss.dup) def test_timeout(self): # Issue #8524: when creating an SSL socket, the timeout of the @@ -2645,6 +2646,7 @@ def _recvfrom_into(): self.assertEqual(s.read(-1, buffer), len(data)) self.assertEqual(buffer, data) + self.assertRaises(NotImplementedError, s.dup) s.write(b"over\n") self.assertRaises(ValueError, s.recv, -1)