From: Finn B. <bc...@us...> - 2002-05-26 20:47:24
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv8190 Modified Files: __builtin__.java Log Message: Added restrictions on complex() arguments. Index: __builtin__.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/__builtin__.java,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** __builtin__.java 11 Mar 2002 13:22:30 -0000 2.43 --- __builtin__.java 26 May 2002 20:47:20 -0000 2.44 *************** *** 217,220 **** --- 217,225 ---- public static PyComplex complex(PyObject real, PyObject imag) { + if (real instanceof PyString) + throw Py.TypeError("complex() can't take second arg" + + " if first is a string"); + if (imag instanceof PyString) + throw Py.TypeError("complex() second arg can't be a string"); return (PyComplex)real.__complex__().__add__( imag.__complex__().__mul__(PyComplex.J)); |