From: <pj...@us...> - 2008-07-14 19:24:57
|
Revision: 4930 http://jython.svn.sourceforge.net/jython/?rev=4930&view=rev Author: pjenvey Date: 2008-07-14 12:24:49 -0700 (Mon, 14 Jul 2008) Log Message: ----------- couple small array fixes Modified Paths: -------------- branches/asm/src/org/python/core/PyArray.java Modified: branches/asm/src/org/python/core/PyArray.java =================================================================== --- branches/asm/src/org/python/core/PyArray.java 2008-07-14 17:41:33 UTC (rev 4929) +++ branches/asm/src/org/python/core/PyArray.java 2008-07-14 19:24:49 UTC (rev 4930) @@ -91,13 +91,16 @@ if (obj instanceof PyString) { String code = obj.toString(); if (code.length() != 1) { - throw Py.ValueError("array() argument 1 must be char, not str"); + throw Py.TypeError("array() argument 1 must be char, not str"); } type = char2class(code.charAt(0)); typecode = code; } else if (obj instanceof PyJavaClass) { type = ((PyJavaClass)obj).proxyClass; typecode = type.getName(); + } else { + throw Py.TypeError("array() argument 1 must be char, not " + + obj.getType().fastGetName()); } data = Array.newInstance(type, 0); delegate = new ArrayDelegate(); @@ -227,6 +230,10 @@ seq___delslice__(start, stop, step); } + public PyObject __add__(PyObject other) { + return array___add__(other); + } + /** * Adds (appends) two PyArrays together * @@ -234,7 +241,8 @@ * a PyArray to be added to the instance * @return the result of the addition as a new PyArray instance */ - public PyObject __add__(PyObject other) { + @ExposedMethod + final PyObject array___add__(PyObject other) { PyArray otherArr = null; if(!(other instanceof PyArray)) { throw Py.TypeError("can only append another array to an array"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |