Issue1455153
Created on 2006-03-21.04:57:29 by kzuberi, last changed 2007-07-27.14:12:10 by fwierzbicki.
msg2480 (view) |
Author: Khalid Zuberi (kzuberi) |
Date: 2006-03-21.04:57:29 |
|
The attached set of patches are an attempt at fixes for
several bugs encountered while executing parts of
test_descr.py from cpython 2.3.5 against jython cvs.
Since test_descr.py is long and many other parts still
fail, i've extracted/simplified the tests of interest
and attached them as a stand-alone script.
The specific bugs are a recursion/stack-overflow in
dict subtypes that override parents __getitem__(),
list's __getslice__()/__setslice__() methods not
accepting the 2/3 argument forms, and an incorrect
error type being raised for certain dict constructor args.
I'm not certain its all correct, review appreciated.
- kz
|
msg2481 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2006-05-24.17:04:43 |
|
Logged In: YES
user_id=193969
The overflow fix breaks test_descrtut -- but I'm accepting
the rest.
|
msg2482 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2006-05-24.17:07:14 |
|
Logged In: YES
user_id=193969
That is to say I'm accepting the fixes, though I am going to
apply them to the templating code and not directly -- I've
sent an email to jython-dev and to you on the subject. I'll
reprint here for reference:
note that in some cases instead of applying them directly to
the source code under jython/src/... I applied them to the
source generation code in sandbox/jt. So the changes to
derived classes went into object.derived, and the changes to
the number of args sequences can take went into seq.expose.
Followed by running:
python gderived.py dict.derived >
../../jython/src/org/python/core/PyDictionaryDerived.java
python gexpose.py dict.expose
../../jython/src/org/python/core/PyDictionary.java
python gderived.py list.derived >
../../jython/src/org/python/core/PyListDerived.java
python gexpose.py list.expose
../../jython/src/org/python/core/PyList.java
I know the templating code is pretty much undocumented at
this point, hopefully I'll eventually find time to produce
some docs for it...
I wasn't able to apply the change from looking up
__finditem__ to looking up __getitem__ (which causes the
stack overflow) because it broke test_descrtut.py, which
worked before. Perhaps the test:
def t4():
"""
jython recursively calls __getitem__ until it
blows the stack
"""
class C(dict):
def __getitem__(self, key):
return self.get(key)
d = C()
if not (d[1] == None):
print "Failure"
else:
print "Success"
exposes an implementation detail... since to my eyes an
overflow doesn't seem to be surprising when a call to
self.__getitem__(key) calls self.get(key). In any case,
we'd have to find a way so that both the test_descr test and
the test_descrtut test can pass. The part of test_descrtut
that fails is
>>> exec "print foo" in a
on line 83
|
msg2483 (view) |
Author: Samuele Pedroni (pedronis) |
Date: 2006-10-16.01:03:01 |
|
Logged In: YES
user_id=61408
r2957/2958 should finish addressing this on the trunk.
I made jython more similar to CPython. get will not delegate
to an overriden __getitem__ by default. We are too incosistent
in doing that overall to make this worth the difference
vs cpython.
I had to fix other stack overflows/infinite recursion related
on how str/unicode and tuples didn't follow the lead of
lists in using PySequence without getting into trouble.
|
msg2484 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2007-07-27.14:12:10 |
|
I think this is finished. Closing.
|
|
Date |
User |
Action |
Args |
2006-03-21 04:57:29 | kzuberi | create | |
|