From: Serhiy Storchaka Date: Fri, 20 Mar 2015 14:48:02 +0000 (+0200) Subject: Issue #23681: Fixed Python 2 to 3 poring bugs. X-Git-Tag: v3.5.0a3~107 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee4c0b9dcfb550094cca086a032d44393b5c3642;p=python Issue #23681: Fixed Python 2 to 3 poring bugs. Indexing bytes retiurns an integer, not bytes. --- ee4c0b9dcfb550094cca086a032d44393b5c3642 diff --cc Lib/smtpd.py index 33653d4fbf,1fa157ade7..0fae1702a6 --- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@@ -134,33 -128,14 +134,33 @@@ class SMTPChannel(asynchat.async_chat) self.conn = conn self.addr = addr self.data_size_limit = data_size_limit - self.received_lines = [] - self.smtp_state = self.COMMAND + self.enable_SMTPUTF8 = enable_SMTPUTF8 + if enable_SMTPUTF8: + if decode_data: + ValueError("decode_data and enable_SMTPUTF8 cannot be set to" + " True at the same time") + decode_data = False + if decode_data is None: + warn("The decode_data default of True will change to False in 3.6;" + " specify an explicit value for this keyword", + DeprecationWarning, 2) + decode_data = True + self._decode_data = decode_data + if decode_data: + self._emptystring = '' + self._linesep = '\r\n' + self._dotsep = '.' + self._newline = NEWLINE + else: + self._emptystring = b'' + self._linesep = b'\r\n' - self._dotsep = b'.' ++ self._dotsep = ord(b'.') + self._newline = b'\n' + self._set_rset_state() self.seen_greeting = '' - self.mailfrom = None - self.rcpttos = [] - self.received_data = '' + self.extended_smtp = False + self.command_size_limits.clear() self.fqdn = socket.getfqdn() - self.num_bytes = 0 try: self.peer = conn.getpeername() except OSError as err: