New submission from Taldor <tinu...@skynet.be>:

Calling the unicode function on a proxy object, doesn't use the proxi-ed
object's __unicode__ method, but its __str__ method.

>>> class A(object):
...   def __str__(self):
...     return "str"    
...   def __unicode__(self):
...     return "unicode"    
...                         
>>> a = A()
>>> unicode(a)
u'unicode'
>>> import weakref
>>> b = weakref.proxy(a)
>>> unicode(b)
u'str'

I expected the last result to be u'unicode'. I did get u'unicode' in
Python 2.5 (but not in 2.6).

----------
components: None
messages: 80416
nosy: Taldor
severity: normal
status: open
title: unexpected unicode behavior for proxy objects
type: behavior
versions: Python 2.6

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

Reply via email to