From: <fwi...@us...> - 2009-01-23 01:03:41
|
Revision: 5961 http://jython.svn.sourceforge.net/jython/?rev=5961&view=rev Author: fwierzbicki Date: 2009-01-23 01:03:39 +0000 (Fri, 23 Jan 2009) Log Message: ----------- Over-ride pyset in PyTuple so our tuples go back to being immutable. Fixes http://bugs.jython.org/issue1242. Modified Paths: -------------- trunk/jython/Lib/test/test_tuple.py trunk/jython/src/org/python/core/PyTuple.java Modified: trunk/jython/Lib/test/test_tuple.py =================================================================== --- trunk/jython/Lib/test/test_tuple.py 2009-01-22 20:20:59 UTC (rev 5960) +++ trunk/jython/Lib/test/test_tuple.py 2009-01-23 01:03:39 UTC (rev 5961) @@ -88,6 +88,12 @@ self.assertEqual(repr(a0), "()") self.assertEqual(repr(a2), "(0, 1, 2)") + def test_setitem(self): + #This test is equivalent to (1,2)[0] = 0 which was briefly broken in + #Jython 2.5b2 + import operator + self.assertRaises(TypeError, operator.setitem, (1,2), 0, 0) + def test_main(): test_support.run_unittest(TupleTest) Modified: trunk/jython/src/org/python/core/PyTuple.java =================================================================== --- trunk/jython/src/org/python/core/PyTuple.java 2009-01-22 20:20:59 UTC (rev 5960) +++ trunk/jython/src/org/python/core/PyTuple.java 2009-01-23 01:03:39 UTC (rev 5961) @@ -384,4 +384,9 @@ } return super.unsupportedopMessage(op, o2); } + + public void pyset(int index, PyObject value) { + throw Py.TypeError("'tuple' object does not support item assignment"); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |