bpo-34246: Use no mutable default args in smtplib (GH-8554)

Some methods of the SMTP class use mutable default arguments. Specially
`send_message` is affected as it mutates one of the args by appending items
to it, which has side effects on further calls.
This commit is contained in:
Pablo Aguiar 2018-09-08 00:04:48 +02:00 committed by Pablo Galindo
parent 4e519377b1
commit d5fbe9b1a3
5 changed files with 39 additions and 8 deletions

View file

@ -419,7 +419,7 @@ An :class:`SMTP` instance has the following methods:
:exc:`SMTPException`.
.. method:: SMTP.sendmail(from_addr, to_addrs, msg, mail_options=[], rcpt_options=[])
.. method:: SMTP.sendmail(from_addr, to_addrs, msg, mail_options=(), rcpt_options=())
Send mail. The required arguments are an :rfc:`822` from-address string, a list
of :rfc:`822` to-address strings (a bare string will be treated as a list with 1
@ -491,7 +491,7 @@ An :class:`SMTP` instance has the following methods:
.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \
mail_options=[], rcpt_options=[])
mail_options=(), rcpt_options=())
This is a convenience method for calling :meth:`sendmail` with the message
represented by an :class:`email.message.Message` object. The arguments have