From: <fwi...@us...> - 2008-12-15 17:04:21
|
Revision: 5767 http://jython.svn.sourceforge.net/jython/?rev=5767&view=rev Author: fwierzbicki Date: 2008-12-15 17:04:17 +0000 (Mon, 15 Dec 2008) Log Message: ----------- results of object.derived change for http://bugs.jython.org/issue1758318. We now pass unmodified test_bool.py, so deleting our version of that as well. Modified Paths: -------------- trunk/jython/src/org/python/antlr/ast/AssertDerived.java trunk/jython/src/org/python/antlr/ast/AssignDerived.java trunk/jython/src/org/python/antlr/ast/AttributeDerived.java trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java trunk/jython/src/org/python/antlr/ast/BinOpDerived.java trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java trunk/jython/src/org/python/antlr/ast/BreakDerived.java trunk/jython/src/org/python/antlr/ast/CallDerived.java trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java trunk/jython/src/org/python/antlr/ast/CompareDerived.java trunk/jython/src/org/python/antlr/ast/ContinueDerived.java trunk/jython/src/org/python/antlr/ast/DeleteDerived.java trunk/jython/src/org/python/antlr/ast/DictDerived.java trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java trunk/jython/src/org/python/antlr/ast/ExecDerived.java trunk/jython/src/org/python/antlr/ast/ExprDerived.java trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java trunk/jython/src/org/python/antlr/ast/ForDerived.java trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java trunk/jython/src/org/python/antlr/ast/GlobalDerived.java trunk/jython/src/org/python/antlr/ast/IfDerived.java trunk/jython/src/org/python/antlr/ast/IfExpDerived.java trunk/jython/src/org/python/antlr/ast/ImportDerived.java trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java trunk/jython/src/org/python/antlr/ast/IndexDerived.java trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java trunk/jython/src/org/python/antlr/ast/LambdaDerived.java trunk/jython/src/org/python/antlr/ast/ListCompDerived.java trunk/jython/src/org/python/antlr/ast/ListDerived.java trunk/jython/src/org/python/antlr/ast/ModuleDerived.java trunk/jython/src/org/python/antlr/ast/NameDerived.java trunk/jython/src/org/python/antlr/ast/NumDerived.java trunk/jython/src/org/python/antlr/ast/PassDerived.java trunk/jython/src/org/python/antlr/ast/PrintDerived.java trunk/jython/src/org/python/antlr/ast/RaiseDerived.java trunk/jython/src/org/python/antlr/ast/ReprDerived.java trunk/jython/src/org/python/antlr/ast/ReturnDerived.java trunk/jython/src/org/python/antlr/ast/SliceDerived.java trunk/jython/src/org/python/antlr/ast/StrDerived.java trunk/jython/src/org/python/antlr/ast/SubscriptDerived.java trunk/jython/src/org/python/antlr/ast/SuiteDerived.java trunk/jython/src/org/python/antlr/ast/TryExceptDerived.java trunk/jython/src/org/python/antlr/ast/TryFinallyDerived.java trunk/jython/src/org/python/antlr/ast/TupleDerived.java trunk/jython/src/org/python/antlr/ast/UnaryOpDerived.java trunk/jython/src/org/python/antlr/ast/WhileDerived.java trunk/jython/src/org/python/antlr/ast/WithDerived.java trunk/jython/src/org/python/antlr/ast/YieldDerived.java trunk/jython/src/org/python/antlr/ast/aliasDerived.java trunk/jython/src/org/python/antlr/ast/argumentsDerived.java trunk/jython/src/org/python/antlr/ast/comprehensionDerived.java trunk/jython/src/org/python/antlr/ast/keywordDerived.java trunk/jython/src/org/python/antlr/op/AddDerived.java trunk/jython/src/org/python/antlr/op/AndDerived.java trunk/jython/src/org/python/antlr/op/AugLoadDerived.java trunk/jython/src/org/python/antlr/op/AugStoreDerived.java trunk/jython/src/org/python/antlr/op/BitAndDerived.java trunk/jython/src/org/python/antlr/op/BitOrDerived.java trunk/jython/src/org/python/antlr/op/BitXorDerived.java trunk/jython/src/org/python/antlr/op/DelDerived.java trunk/jython/src/org/python/antlr/op/DivDerived.java trunk/jython/src/org/python/antlr/op/EqDerived.java trunk/jython/src/org/python/antlr/op/FloorDivDerived.java trunk/jython/src/org/python/antlr/op/GtDerived.java trunk/jython/src/org/python/antlr/op/GtEDerived.java trunk/jython/src/org/python/antlr/op/InDerived.java trunk/jython/src/org/python/antlr/op/InvertDerived.java trunk/jython/src/org/python/antlr/op/IsDerived.java trunk/jython/src/org/python/antlr/op/IsNotDerived.java trunk/jython/src/org/python/antlr/op/LShiftDerived.java trunk/jython/src/org/python/antlr/op/LoadDerived.java trunk/jython/src/org/python/antlr/op/LtDerived.java trunk/jython/src/org/python/antlr/op/LtEDerived.java trunk/jython/src/org/python/antlr/op/ModDerived.java trunk/jython/src/org/python/antlr/op/MultDerived.java trunk/jython/src/org/python/antlr/op/NotDerived.java trunk/jython/src/org/python/antlr/op/NotEqDerived.java trunk/jython/src/org/python/antlr/op/NotInDerived.java trunk/jython/src/org/python/antlr/op/OrDerived.java trunk/jython/src/org/python/antlr/op/ParamDerived.java trunk/jython/src/org/python/antlr/op/PowDerived.java trunk/jython/src/org/python/antlr/op/RShiftDerived.java trunk/jython/src/org/python/antlr/op/StoreDerived.java trunk/jython/src/org/python/antlr/op/SubDerived.java trunk/jython/src/org/python/antlr/op/UAddDerived.java trunk/jython/src/org/python/antlr/op/USubDerived.java trunk/jython/src/org/python/core/PyArrayDerived.java trunk/jython/src/org/python/core/PyBaseExceptionDerived.java trunk/jython/src/org/python/core/PyBooleanDerived.java trunk/jython/src/org/python/core/PyClassMethodDerived.java trunk/jython/src/org/python/core/PyComplexDerived.java trunk/jython/src/org/python/core/PyDictionaryDerived.java trunk/jython/src/org/python/core/PyEnumerateDerived.java trunk/jython/src/org/python/core/PyFileDerived.java trunk/jython/src/org/python/core/PyFloatDerived.java trunk/jython/src/org/python/core/PyFrozenSetDerived.java trunk/jython/src/org/python/core/PyIntegerDerived.java trunk/jython/src/org/python/core/PyListDerived.java trunk/jython/src/org/python/core/PyLongDerived.java trunk/jython/src/org/python/core/PyModuleDerived.java trunk/jython/src/org/python/core/PyObjectDerived.java trunk/jython/src/org/python/core/PyPropertyDerived.java trunk/jython/src/org/python/core/PySetDerived.java trunk/jython/src/org/python/core/PySliceDerived.java trunk/jython/src/org/python/core/PyStringDerived.java trunk/jython/src/org/python/core/PySuperDerived.java trunk/jython/src/org/python/core/PyTupleDerived.java trunk/jython/src/org/python/core/PyTypeDerived.java trunk/jython/src/org/python/core/PyUnicodeDerived.java trunk/jython/src/org/python/modules/_collections/PyDefaultDictDerived.java trunk/jython/src/org/python/modules/_collections/PyDequeDerived.java trunk/jython/src/org/python/modules/_csv/PyDialectDerived.java trunk/jython/src/org/python/modules/_functools/PyPartialDerived.java trunk/jython/src/org/python/modules/_weakref/ReferenceTypeDerived.java trunk/jython/src/org/python/modules/random/PyRandomDerived.java trunk/jython/src/org/python/modules/thread/PyLocalDerived.java trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java Removed Paths: ------------- trunk/jython/Lib/test/test_bool.py Deleted: trunk/jython/Lib/test/test_bool.py =================================================================== --- trunk/jython/Lib/test/test_bool.py 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/Lib/test/test_bool.py 2008-12-15 17:04:17 UTC (rev 5767) @@ -1,351 +0,0 @@ -# Test properties of bool promised by PEP 285 - -import unittest -from test import test_support - -import os - -class BoolTest(unittest.TestCase): - - def assertIs(self, a, b): - self.assert_(a is b) - - def assertIsNot(self, a, b): - self.assert_(a is not b) - - def test_subclass(self): - try: - class C(bool): - pass - except TypeError: - pass - else: - self.fail("bool should not be subclassable") - - self.assertRaises(TypeError, int.__new__, bool, 0) - - def test_print(self): - try: - fo = open(test_support.TESTFN, "wb") - print >> fo, False, True - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), 'False True\n') - finally: - fo.close() - os.remove(test_support.TESTFN) - - def test_repr(self): - self.assertEqual(repr(False), 'False') - self.assertEqual(repr(True), 'True') - self.assertEqual(eval(repr(False)), False) - self.assertEqual(eval(repr(True)), True) - - def test_str(self): - self.assertEqual(str(False), 'False') - self.assertEqual(str(True), 'True') - - def test_int(self): - self.assertEqual(int(False), 0) - self.assertIsNot(int(False), False) - self.assertEqual(int(True), 1) - self.assertIsNot(int(True), True) - - def test_math(self): - self.assertEqual(+False, 0) - self.assertIsNot(+False, False) - self.assertEqual(-False, 0) - self.assertIsNot(-False, False) - self.assertEqual(abs(False), 0) - self.assertIsNot(abs(False), False) - self.assertEqual(+True, 1) - self.assertIsNot(+True, True) - self.assertEqual(-True, -1) - self.assertEqual(abs(True), 1) - self.assertIsNot(abs(True), True) - self.assertEqual(~False, -1) - self.assertEqual(~True, -2) - - self.assertEqual(False+2, 2) - self.assertEqual(True+2, 3) - self.assertEqual(2+False, 2) - self.assertEqual(2+True, 3) - - self.assertEqual(False+False, 0) - self.assertIsNot(False+False, False) - self.assertEqual(False+True, 1) - self.assertIsNot(False+True, True) - self.assertEqual(True+False, 1) - self.assertIsNot(True+False, True) - self.assertEqual(True+True, 2) - - self.assertEqual(True-True, 0) - self.assertIsNot(True-True, False) - self.assertEqual(False-False, 0) - self.assertIsNot(False-False, False) - self.assertEqual(True-False, 1) - self.assertIsNot(True-False, True) - self.assertEqual(False-True, -1) - - self.assertEqual(True*1, 1) - self.assertEqual(False*1, 0) - self.assertIsNot(False*1, False) - - self.assertEqual(True/1, 1) - self.assertIsNot(True/1, True) - self.assertEqual(False/1, 0) - self.assertIsNot(False/1, False) - - for b in False, True: - for i in 0, 1, 2: - self.assertEqual(b**i, int(b)**i) - self.assertIsNot(b**i, bool(int(b)**i)) - - for a in False, True: - for b in False, True: - self.assertIs(a&b, bool(int(a)&int(b))) - self.assertIs(a|b, bool(int(a)|int(b))) - self.assertIs(a^b, bool(int(a)^int(b))) - self.assertEqual(a&int(b), int(a)&int(b)) - self.assertIsNot(a&int(b), bool(int(a)&int(b))) - self.assertEqual(a|int(b), int(a)|int(b)) - self.assertIsNot(a|int(b), bool(int(a)|int(b))) - self.assertEqual(a^int(b), int(a)^int(b)) - self.assertIsNot(a^int(b), bool(int(a)^int(b))) - self.assertEqual(int(a)&b, int(a)&int(b)) - self.assertIsNot(int(a)&b, bool(int(a)&int(b))) - self.assertEqual(int(a)|b, int(a)|int(b)) - self.assertIsNot(int(a)|b, bool(int(a)|int(b))) - self.assertEqual(int(a)^b, int(a)^int(b)) - self.assertIsNot(int(a)^b, bool(int(a)^int(b))) - - self.assertIs(1==1, True) - self.assertIs(1==0, False) - self.assertIs(0<1, True) - self.assertIs(1<0, False) - self.assertIs(0<=0, True) - self.assertIs(1<=0, False) - self.assertIs(1>0, True) - self.assertIs(1>1, False) - self.assertIs(1>=1, True) - self.assertIs(0>=1, False) - self.assertIs(0!=1, True) - self.assertIs(0!=0, False) - - x = [1] - self.assertIs(x is x, True) - self.assertIs(x is not x, False) - - self.assertIs(1 in x, True) - self.assertIs(0 in x, False) - self.assertIs(1 not in x, False) - self.assertIs(0 not in x, True) - - x = {1: 2} - self.assertIs(x is x, True) - self.assertIs(x is not x, False) - - self.assertIs(1 in x, True) - self.assertIs(0 in x, False) - self.assertIs(1 not in x, False) - self.assertIs(0 not in x, True) - - self.assertIs(not True, False) - self.assertIs(not False, True) - - def test_convert(self): - self.assertRaises(TypeError, bool, 42, 42) - self.assertIs(bool(10), True) - self.assertIs(bool(1), True) - self.assertIs(bool(-1), True) - self.assertIs(bool(0), False) - self.assertIs(bool("hello"), True) - self.assertIs(bool(""), False) - self.assertIs(bool(), False) - - def test_hasattr(self): - self.assertIs(hasattr([], "append"), True) - self.assertIs(hasattr([], "wobble"), False) - - def test_callable(self): - self.assertIs(callable(len), True) - self.assertIs(callable(1), False) - - def test_isinstance(self): - self.assertIs(isinstance(True, bool), True) - self.assertIs(isinstance(False, bool), True) - self.assertIs(isinstance(True, int), True) - self.assertIs(isinstance(False, int), True) - self.assertIs(isinstance(1, bool), False) - self.assertIs(isinstance(0, bool), False) - - def test_issubclass(self): - self.assertIs(issubclass(bool, int), True) - self.assertIs(issubclass(int, bool), False) - - def test_haskey(self): - self.assertIs({}.has_key(1), False) - self.assertIs({1:1}.has_key(1), True) - - def test_string(self): - self.assertIs("xyz".endswith("z"), True) - self.assertIs("xyz".endswith("x"), False) - self.assertIs("xyz0123".isalnum(), True) - self.assertIs("@#$%".isalnum(), False) - self.assertIs("xyz".isalpha(), True) - self.assertIs("@#$%".isalpha(), False) - self.assertIs("0123".isdigit(), True) - self.assertIs("xyz".isdigit(), False) - self.assertIs("xyz".islower(), True) - self.assertIs("XYZ".islower(), False) - self.assertIs(" ".isspace(), True) - self.assertIs("XYZ".isspace(), False) - self.assertIs("X".istitle(), True) - self.assertIs("x".istitle(), False) - self.assertIs("XYZ".isupper(), True) - self.assertIs("xyz".isupper(), False) - self.assertIs("xyz".startswith("x"), True) - self.assertIs("xyz".startswith("z"), False) - - if test_support.have_unicode: - self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) - self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) - self.assertIs(unicode("xyz0123", 'ascii').isalnum(), True) - self.assertIs(unicode("@#$%", 'ascii').isalnum(), False) - self.assertIs(unicode("xyz", 'ascii').isalpha(), True) - self.assertIs(unicode("@#$%", 'ascii').isalpha(), False) - self.assertIs(unicode("0123", 'ascii').isdecimal(), True) - self.assertIs(unicode("xyz", 'ascii').isdecimal(), False) - self.assertIs(unicode("0123", 'ascii').isdigit(), True) - self.assertIs(unicode("xyz", 'ascii').isdigit(), False) - self.assertIs(unicode("xyz", 'ascii').islower(), True) - self.assertIs(unicode("XYZ", 'ascii').islower(), False) - self.assertIs(unicode("0123", 'ascii').isnumeric(), True) - self.assertIs(unicode("xyz", 'ascii').isnumeric(), False) - self.assertIs(unicode(" ", 'ascii').isspace(), True) - self.assertIs(unicode("XYZ", 'ascii').isspace(), False) - self.assertIs(unicode("X", 'ascii').istitle(), True) - self.assertIs(unicode("x", 'ascii').istitle(), False) - self.assertIs(unicode("XYZ", 'ascii').isupper(), True) - self.assertIs(unicode("xyz", 'ascii').isupper(), False) - self.assertIs(unicode("xyz", 'ascii').startswith(unicode("x", 'ascii')), True) - self.assertIs(unicode("xyz", 'ascii').startswith(unicode("z", 'ascii')), False) - - def test_boolean(self): - self.assertEqual(True & 1, 1) - self.assert_(not isinstance(True & 1, bool)) - self.assertIs(True & True, True) - - self.assertEqual(True | 1, 1) - self.assert_(not isinstance(True | 1, bool)) - self.assertIs(True | True, True) - - self.assertEqual(True ^ 1, 0) - self.assert_(not isinstance(True ^ 1, bool)) - self.assertIs(True ^ True, False) - - def test_fileclosed(self): - try: - f = file(test_support.TESTFN, "w") - self.assertIs(f.closed, False) - f.close() - self.assertIs(f.closed, True) - finally: - os.remove(test_support.TESTFN) - - def test_operator(self): - import operator - self.assertIs(operator.truth(0), False) - self.assertIs(operator.truth(1), True) - self.assertIs(operator.isCallable(0), False) - self.assertIs(operator.isCallable(len), True) - self.assertIs(operator.isNumberType(None), False) - self.assertIs(operator.isNumberType(0), True) - self.assertIs(operator.not_(1), False) - self.assertIs(operator.not_(0), True) - self.assertIs(operator.isSequenceType(0), False) - self.assertIs(operator.isSequenceType([]), True) - self.assertIs(operator.contains([], 1), False) - self.assertIs(operator.contains([1], 1), True) - self.assertIs(operator.isMappingType(1), False) - self.assertIs(operator.isMappingType({}), True) - self.assertIs(operator.lt(0, 0), False) - self.assertIs(operator.lt(0, 1), True) - self.assertIs(operator.is_(True, True), True) - self.assertIs(operator.is_(True, False), False) - self.assertIs(operator.is_not(True, True), False) - self.assertIs(operator.is_not(True, False), True) - - def test_marshal(self): - import marshal - self.assertIs(marshal.loads(marshal.dumps(True)), True) - self.assertIs(marshal.loads(marshal.dumps(False)), False) - - def test_pickle(self): - import pickle - self.assertIs(pickle.loads(pickle.dumps(True)), True) - self.assertIs(pickle.loads(pickle.dumps(False)), False) - self.assertIs(pickle.loads(pickle.dumps(True, True)), True) - self.assertIs(pickle.loads(pickle.dumps(False, True)), False) - - def test_cpickle(self): - import cPickle - self.assertIs(cPickle.loads(cPickle.dumps(True)), True) - self.assertIs(cPickle.loads(cPickle.dumps(False)), False) - self.assertIs(cPickle.loads(cPickle.dumps(True, True)), True) - self.assertIs(cPickle.loads(cPickle.dumps(False, True)), False) - - def test_mixedpickle(self): - import pickle, cPickle - self.assertIs(pickle.loads(cPickle.dumps(True)), True) - self.assertIs(pickle.loads(cPickle.dumps(False)), False) - self.assertIs(pickle.loads(cPickle.dumps(True, True)), True) - self.assertIs(pickle.loads(cPickle.dumps(False, True)), False) - - self.assertIs(cPickle.loads(pickle.dumps(True)), True) - self.assertIs(cPickle.loads(pickle.dumps(False)), False) - self.assertIs(cPickle.loads(pickle.dumps(True, True)), True) - self.assertIs(cPickle.loads(pickle.dumps(False, True)), False) - - def test_picklevalues(self): - import pickle, cPickle - - # Test for specific backwards-compatible pickle values - self.assertEqual(pickle.dumps(True), "I01\n.") - self.assertEqual(pickle.dumps(False), "I00\n.") - self.assertEqual(cPickle.dumps(True), "I01\n.") - self.assertEqual(cPickle.dumps(False), "I00\n.") - self.assertEqual(pickle.dumps(True, True), "I01\n.") - self.assertEqual(pickle.dumps(False, True), "I00\n.") - self.assertEqual(cPickle.dumps(True, True), "I01\n.") - self.assertEqual(cPickle.dumps(False, True), "I00\n.") - - def test_convert_to_bool(self): - # Verify that TypeError occurs when bad things are returned - # from __nonzero__(). This isn't really a bool test, but - # it's related. - check = lambda o: self.assertRaises(TypeError, bool, o) - class Foo(object): - def __nonzero__(self): - return self - check(Foo()) - - class Bar(object): - def __nonzero__(self): - return "Yes" - check(Bar()) - - class Baz(int): - def __nonzero__(self): - return self - check(Baz()) - -# StackOverflow if __nonzero__ returns self -# http://jython.org/bugs/1758318 -del BoolTest.test_convert_to_bool - -def test_main(): - test_support.run_unittest(BoolTest) - -if __name__ == "__main__": - test_main() Modified: trunk/jython/src/org/python/antlr/ast/AssertDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AssertDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/AssertDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/AssignDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AssignDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/AssignDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/AttributeDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AttributeDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/AttributeDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/BinOpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BinOpDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/BinOpDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/BreakDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BreakDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/BreakDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/CallDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/CallDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/CallDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/CompareDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/CompareDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/CompareDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ContinueDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ContinueDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ContinueDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/DeleteDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/DeleteDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/DeleteDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/DictDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/DictDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/DictDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ExecDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExecDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ExecDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ExprDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExprDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ExprDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ForDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ForDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ForDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/GlobalDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/GlobalDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/GlobalDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/IfDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IfDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/IfDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/IfExpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IfExpDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/IfExpDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ImportDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ImportDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ImportDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/IndexDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IndexDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/IndexDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/LambdaDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/LambdaDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/LambdaDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ListCompDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ListCompDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ListCompDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ListDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ListDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ListDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/ModuleDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ModuleDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/ModuleDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); } } } Modified: trunk/jython/src/org/python/antlr/ast/NameDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/NameDerived.java 2008-12-15 17:01:52 UTC (rev 5766) +++ trunk/jython/src/org/python/antlr/ast/NameDerived.java 2008-12-15 17:04:17 UTC (rev 5767) @@ -793,7 +793,12 @@ if (impl==null) return super.__nonzero__(); } - return impl.__get__(this,self_type).__call__().__nonzero__(); + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); } public boolean __contains__(PyObject o) { @@ -1093,6 +1098,7 @@ if (res!=Py.None) { throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); } + proxyInit(); ... [truncated message content] |