This specific error seems to come down to the fact that IronPython implements str.__cmp__ while CPython apparently does not.
PS C:\src> ipyd IronPython 2.0 Beta (2.0.0.5000) on .NET 2.0.50727.3069 Type "help", "copyright", "credits" or "license" for more information. >>> str.__cmp__ <method '__cmp__' of 'str' objects> >>> ^Z PS C:\src> C:\Python25\python.exe Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> str.__cmp__ <method-wrapper '__cmp__' of type object at 0x1E1E30C0> >>> What happens is that IronPython ends up calling str.__cmp__, which correctly reports that its argument isn't a string. CPython apparently calls object.__cmp__ (or something masquerading as it) which is much less picky. It seems to me that this code is overly sensitive to something that should be an implementation detail, but we'd obviously like to provide a way to work around it. Please add this to CodePlex. There may also be a problem as a result of str == unicode; in fact, there's a commented-out assertion in line 175 of functional.py that specifically breaks because this is true. On Sun, Dec 28, 2008 at 4:41 PM, Jeff Hardy <[email protected]> wrote: > Hi all, > I've been on the trail of this bug for months, and I think I've > finally caught a piece of it. I've uploaded a somewhat-minimal repro > to > http://cid-414fa1a9bd174b4b.skydrive.live.com/self.aspx/Public/lazy_cmp.zip. > functional.py<http://cid-414fa1a9bd174b4b.skydrive.live.com/self.aspx/Public/lazy_cmp.zip.functional.py>is > taken from Django and is used extensively by it. The > lazy() function, in particular, has some hairy code in it to enable > lazy objects that seems to be where this problem originates. > > The output of lazy_cmp.py is differsbetween IP 2.0 and Python 2.5: > >python lazy_cmp.py > 1 > > >ipy lazy_cmp.py > Traceback (most recent call last): > File "lazy_cmp.py", line 13, in lazy_cmp.py > File "C:\Users\Jeff\Desktop\lazy_cmp\functional.py", line 191, in > __wrapper__ > TypeError: expected str, got Object_1$6 > > Hopefully the fix is simple, as this completely breaks Django's admin > views. > > - Jeff > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
