Hi Tristan, Would you mind coming up with a small test case that shows this going off the rails? From reading your description, the basic object setup sounds like the following:
class Model(object): def __str__(self): return self.__unicode__() class Poll(Model): pass However, that code complains about the lack of __unicode__ under CPython or Jython with your changes in place, so I must be missing something. Charlie On 9/21/07, Tristan King <[EMAIL PROTECTED]> wrote: > Ok I've been working on the problem quoted at the end of this email and have > come up with a solution. but i'm not sure what to make of it. > > Poll extends from Model and does not implement __str__ or __unicode__, but > inherits __str__ from Model, which calls __unicode__, and __unicode__ from > object. however, object.__unicode__ calls __str__, which in this case is > model.__str__ and so the loop begins. > > of course this code works fine in CPython. so what's different? > simple: > > [EMAIL PROTECTED]:~$ python > Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) > [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> hasattr(object, '__unicode__') > False > >>> > [EMAIL PROTECTED]:~$ jython > Jython 2.3a0 on java1.5.0_11 > Type "copyright", "credits" or "license" for more information. > >>> hasattr(object, '__unicode__') > True > >>> > > so, applying the following patch to jython fixes the aforementioned problem. > and running 'ant bugtests' shows no change > Index: jython/src/org/python/core/PyObject.java > =================================================================== > --- jython/src/org/python/core/PyObject.java (revision > 3484) > +++ jython/src/org/python/core/PyObject.java (working > copy) > @@ -224,7 +224,7 @@ > } > } > - dict.__setitem__("__unicode__",new > PyMethodDescr("__unicode__",PyObject.class,0,0,new > exposed___unicode__(null,null))); > + //dict.__setitem__("__unicode__",new > PyMethodDescr("__unicode__", PyObject.class,0,0,new > exposed___unicode__(null,null))); > class exposed___init__ extends PyBuiltinMethod { > exposed___init__(PyObject self,PyBuiltinFunction.Info info) { > > My question is. Why, if in CPython object.__unicode__ doesn't exist, why > does it in jython? > > > On 20/09/2007, at 7:30 PM, Tristan King wrote: > > I've been working on getting the django tutorial to work, and got up to: > --------------- > # objects.all() displays all the polls in the database. > Poll.objects.all() > [<Poll: Poll object>] > -------------- > before writing this (i'm about to pack it in for the day), which threw me a > nasty error: > .......... > File > "/usr/local/share/jython/Lib/django/db/models/base.py", > line 101, in __str__ > File > "/usr/local/share/jython/Lib/django/utils/encoding.py", > line 37, in force_unicode > File > "/usr/local/share/jython/Lib/django/db/models/base.py", > line 101, in __str__ > File > "/usr/local/share/jython/Lib/django/utils/encoding.py", > line 37, in force_unicode > java.lang.StackOverflowError: java.lang.StackOverflowError > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Jython-dev mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jython-dev > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---