From: SourceForge.net <no...@so...> - 2007-09-25 16:36:56
|
Bugs item #1800378, was opened at 2007-09-22 17:35 Message generated for change (Comment added) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1800378&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: None >Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: tristan (tristanlk) Assigned to: Nobody/Anonymous (nobody) Summary: object.__unicode__ should it exist? Initial Comment: I've been having a few problems moving python code (specifically django) to jython, which is caused by the fact that object.__unicode__ exitst. It doesn't in CPython, so why does it exist in jython? ---------------------------------------------------------------------- >Comment By: Charles Groves (cgroves) Date: 2007-09-25 11:36 Message: Logged In: YES user_id=1174327 Originator: NO Ahh, I was assuming code similar to what you added to PyObject was already in PyInstance. If it wasn't there, unicode(obj) wouldn't call obj.__unicode__ if obj was a classic class. Guess I shouldn't have assumed that worked. I fixed that in r3542 and your test case works. All instances of Python classes are actually instances of PyInstance in the Jython runtime, so by adding that __unicode__ lookup there, it correctly calls the method. This may actually explain why someone added the descriptor in the first place. They didn't understand the PyInstance to Python object instance mapping and were trying to get __unicode__ visible on Python classes. I'm grasping at straws here though. Thanks for tracking this down! ---------------------------------------------------------------------- Comment By: tristan (tristanlk) Date: 2007-09-25 02:58 Message: Logged In: YES user_id=1894863 Originator: YES the descriptor is not the only problem here. attached an updated test_unicode.py which shows the need for the changes to the PyObject.__unicode__ function. File Added: test_unicode.py ---------------------------------------------------------------------- Comment By: Charles Groves (cgroves) Date: 2007-09-24 23:29 Message: Logged In: YES user_id=1174327 Originator: NO __unicode__ descriptor removed on trunk in r3538. ---------------------------------------------------------------------- Comment By: tristan (tristanlk) Date: 2007-09-23 18:08 Message: Logged In: YES user_id=1894863 Originator: YES i've attached a file which shows this problem. File Added: test_unicode.py ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1800378&group_id=12867 |