changeset: 98620:d471cf4a73b2 branch: 3.5 parent: 98601:1e99ba6b7c98 user: R David Murray date: Fri Oct 09 10:19:33 2015 -0400 files: Lib/smtpd.py Lib/test/test_smtpd.py Misc/NEWS description: #25328: add missing raise keyword in decode_data+SMTPUTF8 check. This is a relatively benign bug, since having both be true was correctly rejected at in SMTPServer even before this patch. Patch by Xiang Zhang. diff -r 1e99ba6b7c98 -r d471cf4a73b2 Lib/smtpd.py --- a/Lib/smtpd.py Thu Oct 08 09:55:49 2015 -0700 +++ b/Lib/smtpd.py Fri Oct 09 10:19:33 2015 -0400 @@ -137,8 +137,8 @@ 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") + raise 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;" diff -r 1e99ba6b7c98 -r d471cf4a73b2 Lib/test/test_smtpd.py --- a/Lib/test/test_smtpd.py Thu Oct 08 09:55:49 2015 -0700 +++ b/Lib/test/test_smtpd.py Fri Oct 09 10:19:33 2015 -0400 @@ -313,6 +313,12 @@ DummyDispatcherBroken, BrokenDummyServer, (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): self.server.handle_accept() diff -r 1e99ba6b7c98 -r d471cf4a73b2 Misc/NEWS --- a/Misc/NEWS Thu Oct 08 09:55:49 2015 -0700 +++ b/Misc/NEWS Fri Oct 09 10:19:33 2015 -0400 @@ -37,6 +37,9 @@ Library ------- +- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both + decode_data and enable_SMTPUTF8 are set to true. + - Issue #25316: distutils raises OSError instead of DistutilsPlatformError when MSVC is not installed.