This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients barry, maxking, oon, r.david.murray, terry.reedy
Date 2021-01-08.21:34:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610141669.41.0.903861027247.issue42807@roundup.psfhosted.org>
In-reply-to
Content
I am not familiar with either smtp or email, but I can make some general comments.

1. "AttributeError: 'NoneType' object has no attribute 'get_all'" seems pretty straightforward to me.  Hard to debug?  Depends on knowledge and experience. When coming from library code, it nearly always means that one called a library function with an invalid argument.  None, with only standard dunder attributes, is perhaps the most common bad argument.  Look in the traceback to find the bad call in one's own code, where one must have passed None, even if not by that name.  In this case, if one does not know that 'get_all' is a method of the two email message classes, this can be discovered in the document index.

2. It is not a bug for a function to expect users to know the above and in effect say "Don't do that!" when an attribute reference fails.  So I see this as an enhancement request, not a bugfix report.  But why add a check for None to this particular function?

3. Python functions often use duck-typing, allowing arguments that act sufficiently well like the documented requirement.  While https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message  says that msg should be a Message object, this may not be an exact requirement.  Indeed, https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message starts with "The Message class is very similar to the EmailMessage class ...".  So I wonder, "Is EmailMessage is also allowed?"  Or, "Do  any users pass instances of custom message classes?"

If so, perhaps the doc should be augmented.  But checking only for Message would be wrong, and would break code passing non-Message instances.
History
Date User Action Args
2021-01-08 21:34:29terry.reedysetrecipients: + terry.reedy, barry, r.david.murray, maxking, oon
2021-01-08 21:34:29terry.reedysetmessageid: <1610141669.41.0.903861027247.issue42807@roundup.psfhosted.org>
2021-01-08 21:34:29terry.reedylinkissue42807 messages
2021-01-08 21:34:29terry.reedycreate