[Python-checkins] cpython: Issue #11893: Remove obsolete internal wrapper class `SSLFakeFile` in the

antoine.pitrou python-checkins at python.org
Mon Jun 6 19:18:02 CEST 2011


http://hg.python.org/cpython/rev/b68390b6dbfd
changeset: 70689:b68390b6dbfd
user: Antoine Pitrou <solipsis at pitrou.net>
date: Mon Jun 06 19:17:09 2011 +0200
summary:
 Issue #11893: Remove obsolete internal wrapper class `SSLFakeFile` in the smtplib module.
Patch by Catalin Iacob.
files:
 Lib/smtplib.py | 26 +++-----------------------
 Misc/NEWS | 3 +++
 2 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -172,27 +172,6 @@
 except ImportError:
 _have_ssl = False
 else:
- class SSLFakeFile:
- """A fake file like object that really wraps a SSLObject.
-
- It only supports what is needed in smtplib.
- """
- def __init__(self, sslobj):
- self.sslobj = sslobj
-
- def readline(self):
- str = b""
- chr = None
- while chr != b"\n":
- chr = self.sslobj.read(1)
- if not chr:
- break
- str += chr
- return str
-
- def close(self):
- pass
-
 _have_ssl = True
 
 
@@ -322,6 +301,7 @@
 if self.debuglevel > 0:
 print('connect:', (host, port), file=stderr)
 self.sock = self._get_socket(host, port, self.timeout)
+ self.file = None
 (code, msg) = self.getreply()
 if self.debuglevel > 0:
 print("connect:", msg, file=stderr)
@@ -669,7 +649,7 @@
 self.sock = context.wrap_socket(self.sock)
 else:
 self.sock = ssl.wrap_socket(self.sock, keyfile, certfile)
- self.file = SSLFakeFile(self.sock)
+ self.file = None
 # RFC 3207:
 # The client MUST discard any knowledge obtained from
 # the server, such as the list of SMTP service extensions,
@@ -853,7 +833,6 @@
 new_socket = self.context.wrap_socket(new_socket)
 else:
 new_socket = ssl.wrap_socket(new_socket, self.keyfile, self.certfile)
- self.file = SSLFakeFile(new_socket)
 return new_socket
 
 __all__.append("SMTP_SSL")
@@ -890,6 +869,7 @@
 # Handle Unix-domain sockets.
 try:
 self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ self.file = None
 self.sock.connect(host)
 except socket.error as msg:
 if self.debuglevel > 0:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -187,6 +187,9 @@
 Library
 -------
 
+- Issue #11893: Remove obsolete internal wrapper class ``SSLFakeFile`` in the
+ smtplib module. Patch by Catalin Iacob.
+
 - Issue #12080: Fix a Decimal.power() case that took an unreasonably long time
 to compute.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /