classification
Title: quit() method of SMTP instance (of smtplib) doesn't return it's result
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 2.4, Python 2.6, Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: funagayama, georg.brandl, gvanrossum, jafo
Priority: normal Keywords: patch

Created on 2008-03-07 07:42 by funagayama, last changed 2008-03-27 13:27 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
smtplib.py.patch funagayama, 2008-03-07 07:42
Messages (4)
msg63346 - (view) Author: Kei Funagayama (funagayama) Date: 2008-03-07 07:42
Hi,

I've found that the quit() method of SMTP instance (of smtplib) doesn't
return it's result (such as '221 2.0.0 Bye') .
Other methods such as helo(), ehlo(), verify() etc.. returns it's result
correctly so I suppose it's a kind of bug.

I've made a small patch for this so please take a look at it (It looks
like someone just forgot to return the value of docmd()).

below is the code piece to represent the problem.

>>> import smtplib
>>> s = smtplib.SMTP('localhost')
>>> s.helo() #<---- returns result code
(250, 'localhost')
>>> s.vrfy('user@example.com') #<---- returns result code
(554, '5.7.1 <<user@example.com>>: Relay access denied')
>>> s.quit() #<----- doesn't return anything
>>>

Thanks,
Kei
msg64205 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2008-03-20 20:45
Kei: The documentation does not say that quit() returns a value, so the
current behavior is correct.  However, SMTP defines a return value for
QUIT, so there is a case for smtplib.quit() returning that value.

This patch does need a documentation change to Doc/library/smtplib.rst

Guido: You wrote and last touched this code, any objections?
msg64288 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-03-21 22:06
No time to review, but making a function return something useful instead
of None seems a good idea.
msg64590 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-03-27 13:27
Added docs and committed as r61977.
History
Date User Action Args
2008-03-27 13:27:48georg.brandlsetstatus: open -> closed
nosy: + georg.brandl
resolution: accepted
messages: + msg64590
2008-03-21 22:06:45gvanrossumsetassignee: gvanrossum ->
messages: + msg64288
2008-03-20 20:45:45jafosetpriority: normal
assignee: gvanrossum
type: enhancement
messages: + msg64205
nosy: + gvanrossum, jafo
2008-03-07 07:42:57funagayamacreate