[issue4302] smtplib.py initialisation defect

2008-11-12 Thread Piers Lauder

New submission from Piers Lauder <[EMAIL PROTECTED]>:

smtplib does not initialise the valriable 'sock' in the case where
'host' is NULL on instantiation of smtplib.SMTP.

Eg:

% python
Python 2.5.2 (r252:60911, Oct  5 2008, 19:29:17) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smtplib
>>> client=smtplib.SMTP('')
>>> client.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'test')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.5/smtplib.py", line 676, in sendmail
if not (200 <= self.ehlo()[0] <= 299):
  File "/usr/lib/python2.5/smtplib.py", line 397, in ehlo
self.putcmd("ehlo", name or self.local_hostname)
  File "/usr/lib/python2.5/smtplib.py", line 333, in putcmd
self.send(str)
  File "/usr/lib/python2.5/smtplib.py", line 318, in send
if self.sock:
AttributeError: SMTP instance has no attribute 'sock'
>>>

The fix is to add "self.sock = None" in __init__ if host is not set,
and then the behaviour is much more helpful:

% python
Python 2.5.2 (r252:60911, Oct  5 2008, 19:29:17) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smtplib
>>> client=smtplib.SMTP('')
>>> client.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'test')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.5/smtplib.py", line 678, in sendmail
if not (200 <= self.ehlo()[0] <= 299):
  File "/usr/lib/python2.5/smtplib.py", line 399, in ehlo
self.putcmd("ehlo", name or self.local_hostname)
  File "/usr/lib/python2.5/smtplib.py", line 335, in putcmd
self.send(str)
  File "/usr/lib/python2.5/smtplib.py", line 327, in send
raise SMTPServerDisconnected('please run connect() first')
smtplib.SMTPServerDisconnected: please run connect() first
>>>

--
components: Library (Lib)
files: smtplib-diff-c
messages: 75777
nosy: piers
severity: normal
status: open
title: smtplib.py initialisation defect
type: behavior
versions: Python 2.5.3
Added file: http://bugs.python.org/file11991/smtplib-diff-c

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4302>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5146] threading via uid method doesn't work in imaplib

2009-02-03 Thread Piers Lauder

Piers Lauder  added the comment:

I agree with this change.

It should be propagated to all versions.

___
Python tracker 
<http://bugs.python.org/issue5146>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11245] Implementation of IMAP IDLE in imaplib?

2015-06-12 Thread Piers Lauder

Changes by Piers Lauder :


--
nosy: +piers

___
Python tracker 
<http://bugs.python.org/issue11245>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11245] Implementation of IMAP IDLE in imaplib?

2015-06-12 Thread Piers Lauder

Piers Lauder added the comment:

Hi, apologies for not responding to the "pierslauder" pings, but i don't own 
that login, or at least have forgotten all about it, and its email address is 
invalid (or there is another pierslauder out there).

I maintain imaplib2 on sourceforge (as piersrlauder) at 
https://sourceforge.net/projects/imaplib2/
and that version has just been modified to incorporate the CRAM_MD5_AUTH change 
from python3.6. It is regularly updated with bug fixes and it also has built-in 
tests for the IDLE function.

I originally intended for imaplib2 to be incorporated into pythonlib, leaving 
the original module in place (a la urllib/2). Then people wouldn't be forced 
into a switch using threads except by choice.

Anyway, happy to help.

--

___
Python tracker 
<http://bugs.python.org/issue11245>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com