Merge #25328: add missing raise keyword in decode_data+SMTPUTF8 check.

This commit is contained in:
R David Murray 2015-10-09 10:20:58 -04:00
commit aecf63ee3a
3 changed files with 11 additions and 2 deletions

View File

@ -137,8 +137,8 @@ class SMTPChannel(asynchat.async_chat):
self.enable_SMTPUTF8 = enable_SMTPUTF8 self.enable_SMTPUTF8 = enable_SMTPUTF8
if enable_SMTPUTF8: if enable_SMTPUTF8:
if decode_data: if decode_data:
ValueError("decode_data and enable_SMTPUTF8 cannot be set to" raise ValueError("decode_data and enable_SMTPUTF8 cannot"
" True at the same time") " be set to True at the same time")
decode_data = False decode_data = False
if decode_data is None: if decode_data is None:
warn("The decode_data default of True will change to False in 3.6;" warn("The decode_data default of True will change to False in 3.6;"

View File

@ -313,6 +313,12 @@ class SMTPDChannelTest(unittest.TestCase):
DummyDispatcherBroken, BrokenDummyServer, DummyDispatcherBroken, BrokenDummyServer,
(support.HOST, 0), ('b', 0), decode_data=True) (support.HOST, 0), ('b', 0), decode_data=True)
def test_decode_data_and_enable_SMTPUTF8_raises(self):
self.assertRaises(
ValueError, smtpd.SMTPChannel,
self.server, self.channel.conn, self.channel.addr,
enable_SMTPUTF8=True, decode_data=True)
def test_server_accept(self): def test_server_accept(self):
self.server.handle_accept() self.server.handle_accept()

View File

@ -48,6 +48,9 @@ Core and Builtins
Library Library
------- -------
- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both
decode_data and enable_SMTPUTF8 are set to true.
- Issue #16099: RobotFileParser now supports Crawl-delay and Request-rate - Issue #16099: RobotFileParser now supports Crawl-delay and Request-rate
extensions. Patch by Nikolay Bogoychev. extensions. Patch by Nikolay Bogoychev.