|
[Jython-bugs] [ jython-Patches-1455153 ] dict/list bugfixes
From: SourceForge.net <noreply@so...> - 2007-07-27 14:12
|
Patches item #1455153, was opened at 2006-03-20 23:57 Message generated for change (Comment added) made by fwierzbicki You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1455153&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: None Group: None >Status: Closed Resolution: Accepted Priority: 5 Private: No Submitted By: Khalid Zuberi (kzuberi) Assigned to: Frank Wierzbicki (fwierzbicki) Summary: dict/list bugfixes Initial Comment: 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 ---------------------------------------------------------------------- >Comment By: Frank Wierzbicki (fwierzbicki) Date: 2007-07-27 10:12 Message: Logged In: YES user_id=193969 Originator: NO I think this is finished. Closing. ---------------------------------------------------------------------- Comment By: Samuele Pedroni (pedronis) Date: 2006-10-15 21:03 Message: 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. ---------------------------------------------------------------------- Comment By: Frank Wierzbicki (fwierzbicki) Date: 2006-05-24 13:07 Message: 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 ---------------------------------------------------------------------- Comment By: Frank Wierzbicki (fwierzbicki) Date: 2006-05-24 13:04 Message: Logged In: YES user_id=193969 The overflow fix breaks test_descrtut -- but I'm accepting the rest. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1455153&group_id=12867 |
| Thread | Author | Date |
|---|---|---|
| [Jython-bugs] [ jython-Patches-1455153 ] dict/list bugfixes | SourceForge.net <noreply@so...> |