[issue32657] Mutable Objects in SMTP send_message Signature

2019-02-21 Thread Inada Naoki
Change by Inada Naoki : -- versions: +Python 3.8 -Python 3.6, Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue32657] Mutable Objects in SMTP send_message Signature

2019-02-21 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue32657] Mutable Objects in SMTP send_message Signature

2018-08-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue34246. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mai

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Chason Chaffin
Chason Chaffin added the comment: > It's probably enough to fix it. I fear that if we also change them in > sendmail we'll break someone's code, but maybe we should do that anyway, for > 3.7 only. Should I make a separate issue for that, or attach it to this PR? --

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread R. David Murray
R. David Murray added the comment: It's probably enough to fix it. I fear that if we also change them in sendmail we'll break someone's code, but maybe we should do that anyway, for 3.7 only. -- versions: -Python 2.7, Python 3.4, Python 3.5, Python 3.8 __

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Chason Chaffin
Change by Chason Chaffin : -- keywords: +patch pull_requests: +5180 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-li

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Chason Chaffin
Chason Chaffin added the comment: I'm writing a PR for this right now. Is it worth it to write a test to make sure that mail_options isn't being mutated or is it enough just to update the code to use non-mutable defaults? Interesting side effect of looking into this is #32663 where I found th

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread R. David Murray
R. David Murray added the comment: On Thu, 25 Jan 2018 15:18:01 +, Steven D'Aprano wrote: > On Thu, Jan 25, 2018 at 02:28:17PM +, R. David Murray wrote: > The docstring for send_message does say > > If the sender or any of the recipient addresses contain non-ASCII > and the s

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Jan 25, 2018 at 02:28:17PM +, R. David Murray wrote: > obviously I missed that mutation of the value > in the code review of the patch that added those lines :( The docstring for send_message does say If the sender or any of the recipient a

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread R. David Murray
R. David Murray added the comment: Chason: that does look like a bug. Mutable defaults are best to avoid, but if they are used read-only and not passed down further it isn't a problem. send_message was modeled on sendmail, and so copied it's use of defaults (which date from quite some time b

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Chason Chaffin
Chason Chaffin added the comment: Hi Steven, I have nothing to do with the original submitter but this bug did catch my eye. Does using mutable variables in the SMTP library serve a purpose? Looking through the code, I wasn't able to spot anything obvious, and I did spot a place with a poten

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Kenny, and thanks, but I'm not sure what your point is. Are you claiming this is a bug in the code or the documentation? For what it is worth... mutable defaults *are* a "gotcha", so the documentation isn't wrong. And mutable defaults are *not* illegal no

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Kenny Trytek
New submission from Kenny Trytek : Mutable arguments in signature of send_message: https://github.com/python/cpython/blob/master/Lib/smtplib.py#L892-L893 More Information: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments -- components: Library (Lib) mess