Issue1828
Created on 2011-12-14.12:20:23 by pekka.klarck, last changed 2011-12-16.12:58:58 by pekka.klarck.
msg6743 (view) |
Author: Pekka Klärck (pekka.klarck) |
Date: 2011-12-14.12:20:22 |
|
There are some problems when inheriting from Jython. What I've noticed is that Jython adds 'L' at the end of the string representation and crashes for bool().
To reproduce:
1) Assume we have a file with this content:
class X(long):
pass
print 42, X(42)
print bool(42), bool(X(42))
2) Run with Python (tested with 2.5-2.7):
42 42
True True
3) Run with Jython (tested with 2.5.1 and 2.5.2):
42 42L
True
Traceback (most recent call last):
File "test.py", line 6, in <module>
print bool(42), bool(X(42))
RuntimeError: maximum recursion depth exceeded
|
msg6744 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2011-12-16.00:20:53 |
|
fixed in 68626d94a76d and 825546a4600e, thanks Pekka!
|
msg6745 (view) |
Author: Pekka Klärck (pekka.klarck) |
Date: 2011-12-16.12:58:57 |
|
Great to see issues fixed so fast!
If someone is interested, it's possible to workaround the problems also with the currently releases 2.5 versions so that the code is compatible with CPython:
class X(long):
def __str__(self):
return long.__str__(self).rstrip('L')
def __nonzero__(self):
return bool(long(self))
|
|
Date |
User |
Action |
Args |
2011-12-16 12:58:58 | pekka.klarck | set | messages:
+ msg6745 |
2011-12-16 00:20:59 | pjenvey | set | status: open -> closed resolution: fixed |
2011-12-16 00:20:53 | pjenvey | set | messages:
+ msg6744 |
2011-12-16 00:12:11 | pjenvey | set | assignee: pjenvey nosy:
+ pjenvey |
2011-12-14 12:20:23 | pekka.klarck | create | |
|