From deaf2cafbded0a3ce7a14952c4346604af65724a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 27 Mar 2008 13:27:31 +0000 Subject: #2248: return result of QUIT from quit(). --- Doc/library/smtplib.rst | 7 ++++++- Lib/smtplib.py | 3 ++- Misc/NEWS | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index 0aea80a..3c22f64 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -318,7 +318,12 @@ An :class:`SMTP` instance has the following methods: .. method:: SMTP.quit() - Terminate the SMTP session and close the connection. + Terminate the SMTP session and close the connection. Return the result of + the SMTP ``QUIT`` command. + + .. versionchanged:: 2.6 + Return a value. + Low-level methods corresponding to the standard SMTP/ESMTP commands ``HELP``, ``RSET``, ``NOOP``, ``MAIL``, ``RCPT``, and ``DATA`` are also supported. diff --git a/Lib/smtplib.py b/Lib/smtplib.py index c1b1bec..5ac9fc3 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -726,8 +726,9 @@ class SMTP: def quit(self): """Terminate the SMTP session.""" - self.docmd("quit") + res = self.docmd("quit") self.close() + return res if _have_ssl: diff --git a/Misc/NEWS b/Misc/NEWS index ce72fba..ec65705 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,7 +12,7 @@ What's New in Python 2.6 alpha 2? Core and builtins ----------------- -- Patch #2477: Added from __future__ import unicode_literals +- Patch #2477: Added from __future__ import unicode_literals. - Added backport of bytearray type. @@ -76,6 +76,8 @@ Extensions Modules Library ------- +- Issue #2248: return the result of the QUIT command. from SMTP.quit(). + - Backport of Python 3.0's io module. - Issue #2482: Make sure that the coefficient of a Decimal is always -- cgit v0.12