diff -r 3291e6132a67 Lib/smtpd.py --- a/Lib/smtpd.py Wed Oct 07 11:15:15 2015 +0000 +++ b/Lib/smtpd.py Fri Oct 09 14:21:16 2015 +0800 @@ -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 3291e6132a67 Lib/test/test_smtpd.py --- a/Lib/test/test_smtpd.py Wed Oct 07 11:15:15 2015 +0000 +++ b/Lib/test/test_smtpd.py Fri Oct 09 14:21:16 2015 +0800 @@ -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()