gac added the comment:

Here's a second path I've done for the current/default branch, using a separate 
print function for output, as recommended by Berker Peksag. I tried to add it 
as a separate patch set using the code review tool but every time I did, I just 
got a screen full of debug output from Django so I'm going to attach it here 
instead.

The for loop on args inside _print_debug probably isn't ideal, but I've done 
this to try and make sure that debuglevel 1 output is identical to what it was 
before my patches. Because args is passed into _print_debug as a tuple, I found 
that when doing "print(message, args, file=stderr)" it introduced the extra 
parentheses and quotes inherent with a tuple into the output. By concatenating 
string representations of this tuple onto the existing string it means the 
original output format is duplicated exactly. There may be a speed penalty for 
this, but realistically it seems that a minor speed penalty would be expected 
when using debugging options and the output consistency trumps raw speed for 
debugging.

Once I've found a way of achieving the same in 2.7 (i.e. maintaining the 
original output format when being passed a tuple, the approach I've used for 
Python 3 doesn't seem to have the desired affect in 2.7) then I'll hopefully 
submit a patch for that as well.

----------
Added file: http://bugs.python.org/file28721/smtplib.34.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16914>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to