[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-12-16 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > However, it is a real change from 2.6 to 2.7 that breaks code. John, this issue is not the same as the one above. The difference between Python 2.6 and Python 2.7.2 you mention only applies to % formatting. The change is clearly documented in http://d

[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-12-15 Thread John Nagle
John Nagle added the comment: This has nothing to do with Python 3. There's a difference in __str__ handling between Python 2.6 and Python 2.7.2. It's enough to crash BeautifulSoup: [Thread-8] Unexpected EXCEPTION while processing page "http://www.verisign.com": global name '__str__' is not

[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread R. David Murray
R. David Murray added the comment: Well, it's possible I'm wrong and you've found a bug. There are numerous differences between 2 and 3 in both string handling and special method handling, though, so it may be hard to pin down. If you poke around a bit more and still think it is a bug, plea

[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread Dave Opstad
Dave Opstad added the comment: I guess I was confused by the inconsistency with Python 3, which *does* call the __str__ method, even though, again, no coercion is needed: Python 3.2 (r32:88452, Feb 20 2011, 10:19:59) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "cre

[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread R. David Murray
R. David Murray added the comment: For the record, this isn't as simple as I made it sound. See, for example, issue 9196. -- ___ Python tracker ___ ___

[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread R. David Murray
R. David Murray added the comment: You subclassed unicode. So print printed the value of your unicode object, which didn't need coercion. -- nosy: +r.david.murray resolution: -> invalid stage: -> committed/rejected status: open -> closed ___ Pyth

[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread Dave Opstad
New submission from Dave Opstad : Python 2.7.1 doesn't appear to do the usual implicit call to str() for subclasses of unicode. In the following snippet, I would have expected print myTest and print str(myTest) to behave the same: >>> class Test(unicode): ... def __str__(self): ... print