# HG changeset patch # User Mads Kiilerich # Date 1597779386 -7200 # Node ID 9c408c0f1c9b35f48207a58581016bf30d305752 # Parent 2864cff1f12a0732a5b1dbf703a7e0d664168a69 rcmail: pass smtplib.SMTP.sendmail to_addrs as list Passing it as a set worked ... but is apparently wrong. The documentation states it has to be a "list of addresses". Pytype warned: File "kallithea/lib/rcmail/smtp_mailer.py", line 99, in send: Function SMTP.sendmail was called with the wrong arguments [wrong-arg-types] Expected: (self, from_addr, to_addrs: Union[Sequence[str], str], ...) Actually passed: (self, from_addr, to_addrs: set, ...) diff -r 2864cff1f12a -r 9c408c0f1c9b kallithea/lib/rcmail/smtp_mailer.py --- a/kallithea/lib/rcmail/smtp_mailer.py Sun Aug 23 14:50:56 2020 +0200 +++ b/kallithea/lib/rcmail/smtp_mailer.py Tue Aug 18 21:36:26 2020 +0200 @@ -96,7 +96,7 @@ if self.user and self.passwd: smtp_serv.login(self.user, self.passwd) - smtp_serv.sendmail(msg.sender, msg.send_to, raw_msg.as_string()) + smtp_serv.sendmail(msg.sender, list(msg.send_to), raw_msg.as_string()) logging.info('MAIL SENT TO: %s' % recipients) try: diff -r 2864cff1f12a -r 9c408c0f1c9b kallithea/tests/other/test_mail.py --- a/kallithea/tests/other/test_mail.py Sun Aug 23 14:50:56 2020 +0200 +++ b/kallithea/tests/other/test_mail.py Tue Aug 18 21:36:26 2020 +0200 @@ -21,9 +21,8 @@ def sendmail(self, sender, dest, msg): smtplib_mock.lastsender = sender - smtplib_mock.lastdest = dest + smtplib_mock.lastdest = set(dest) smtplib_mock.lastmsg = msg - pass @mock.patch('kallithea.lib.rcmail.smtp_mailer.smtplib', smtplib_mock)