Message108974
Although the use case is pretty uncommon and somewhat twisted (take a look at Lib/test/test_ftplib.py for a nicer approach on wrapping asyncore.loop() in a thread) it is true that if SMTPServer class raise an exception at instantiation time, some garbage remains in asyncore.
To replicate this problem there's no need to involve threads:
>>> import asyncore, smtpd
>>> s = smtpd.SMTPServer(('127.0.0.1', "xxx"),None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/smtpd.py", line 280, in __init__
self.bind(localaddr)
File "/usr/local/lib/python2.5/asyncore.py", line 303, in bind
return self.socket.bind(addr)
File "<string>", line 1, in bind
TypeError: an integer is required
>>> asyncore.socket_map
{3: <smtpd.SMTPServer ('127.0.0.1', 'xxx') at 0xb783528c>}
>>>
I think it's ok for SMTPServer.__init__ to cleanup asyncore and finally raise the exception, as you suggested in the first place.
I'll provide a patch later today. |
|
Date |
User |
Action |
Args |
2010-06-30 11:39:00 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola, ggenellina, r.david.murray, cmcginty |
2010-06-30 11:38:59 | giampaolo.rodola | set | messageid: <1277897939.91.0.257186131364.issue6589@psf.upfronthosting.co.za> |
2010-06-30 11:38:58 | giampaolo.rodola | link | issue6589 messages |
2010-06-30 11:38:57 | giampaolo.rodola | create | |
|