From: <cg...@us...> - 2007-09-19 11:09:37
|
Revision: 3484 http://jython.svn.sourceforge.net/jython/?rev=3484&view=rev Author: cgroves Date: 2007-09-19 04:09:34 -0700 (Wed, 19 Sep 2007) Log Message: ----------- Merged revisions 3471-3474,3479-3480 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/trunk ........ r3471 | pjenvey | 2007-09-12 17:21:35 -0700 (Wed, 12 Sep 2007) | 1 line prefer importing to using fully qualified names ........ r3472 | pjenvey | 2007-09-12 18:11:26 -0700 (Wed, 12 Sep 2007) | 3 lines s/jpython/jython/g in Lib, Tools and src dirs, except in a few places when referring to historical JPython versions ........ r3473 | pjenvey | 2007-09-12 19:24:24 -0700 (Wed, 12 Sep 2007) | 4 lines override PyDictionary __contains__ to use the optimized dict___contains__ patch: #1783803 thanks ayeshaiqbal ........ r3474 | cgroves | 2007-09-15 14:08:30 -0700 (Sat, 15 Sep 2007) | 1 line Pass *args through to UserDict on pop on LazyDict ........ r3480 | cgroves | 2007-09-19 01:59:31 -0700 (Wed, 19 Sep 2007) | 12 lines Replace all String to byte and byte to String operations that use the default charset with PyString.to_bytes and PyString.from_bytes respectively. These methods assume Strings are being used as byte arrays and have nothing in the high-order half of their chars. They should be used be your one stop shop for byte to String and vice-versa manipulations in Jython. Also make PyUnicode.__str__ encode its string before stuffing it in a PyString. Hopefully this fixes our stomp-indiscriminately-on-your-bytes features that come up if your JVM has a flavorful default charset. ........ Modified Paths: -------------- branches/Release_2_2maint/jython/Lib/javaos.py branches/Release_2_2maint/jython/Lib/pawt/swing.py branches/Release_2_2maint/jython/Lib/test/bugs/pr195.py branches/Release_2_2maint/jython/Lib/test/bugs/pr235.py branches/Release_2_2maint/jython/Lib/test/test_jbasic.py branches/Release_2_2maint/jython/Tools/freeze/Output.py branches/Release_2_2maint/jython/Tools/freeze/freeze.py branches/Release_2_2maint/jython/Tools/jythonc/ObjectFactory.py branches/Release_2_2maint/jython/Tools/jythonc/PythonModule.py branches/Release_2_2maint/jython/Tools/jythonc/compile.py branches/Release_2_2maint/jython/Tools/jythonc/jar.py branches/Release_2_2maint/jython/Tools/jythonc/jast/Output.py branches/Release_2_2maint/jython/Tools/jythonc/javac.py branches/Release_2_2maint/jython/Tools/jythonc/jythonc.py branches/Release_2_2maint/jython/Tools/jythonc/main.py branches/Release_2_2maint/jython/Tools/mkjava.py branches/Release_2_2maint/jython/src/com/ziclix/python/sql/DataHandler.java branches/Release_2_2maint/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java branches/Release_2_2maint/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java branches/Release_2_2maint/jython/src/org/python/core/FilelikeInputStream.java branches/Release_2_2maint/jython/src/org/python/core/Options.java branches/Release_2_2maint/jython/src/org/python/core/Py.java branches/Release_2_2maint/jython/src/org/python/core/PyArray.java branches/Release_2_2maint/jython/src/org/python/core/PyDictionary.java branches/Release_2_2maint/jython/src/org/python/core/PyFile.java branches/Release_2_2maint/jython/src/org/python/core/PyFunction.java branches/Release_2_2maint/jython/src/org/python/core/PyString.java branches/Release_2_2maint/jython/src/org/python/core/PySystemState.java branches/Release_2_2maint/jython/src/org/python/core/PyTableCode.java branches/Release_2_2maint/jython/src/org/python/core/PyUnicode.java branches/Release_2_2maint/jython/src/org/python/core/StdoutWrapper.java branches/Release_2_2maint/jython/src/org/python/core/parser.java branches/Release_2_2maint/jython/src/org/python/modules/MD5Module.java branches/Release_2_2maint/jython/src/org/python/modules/SHA1.java branches/Release_2_2maint/jython/src/org/python/modules/Setup.java branches/Release_2_2maint/jython/src/org/python/modules/binascii.java branches/Release_2_2maint/jython/src/org/python/modules/imp.java branches/Release_2_2maint/jython/src/org/python/modules/time/Time.java branches/Release_2_2maint/jython/src/org/python/util/InteractiveInterpreter.java branches/Release_2_2maint/jython/src/org/python/util/PyServlet.java branches/Release_2_2maint/jython/src/org/python/util/PythonInterpreter.java Property Changed: ---------------- branches/Release_2_2maint/ Property changes on: branches/Release_2_2maint ___________________________________________________________________ Name: svnmerge-integrated - /trunk:1-3437 + /trunk:1-3437,3471-3474,3479-3480 Modified: branches/Release_2_2maint/jython/Lib/javaos.py =================================================================== --- branches/Release_2_2maint/jython/Lib/javaos.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Lib/javaos.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -224,9 +224,9 @@ def popitem(self): self.__populate() return UserDict.popitem( self ) - def pop(self): + def pop(self, *args): self.__populate() - return UserDict.pop(self) + return UserDict.pop(self, *args) def iteritems(self): self.__populate() return UserDict.iteritems(self) Modified: branches/Release_2_2maint/jython/Lib/pawt/swing.py =================================================================== --- branches/Release_2_2maint/jython/Lib/pawt/swing.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Lib/pawt/swing.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -37,6 +37,6 @@ sys.modules['pawt.swing'] = swing swing.__dict__['test'] = test - #These two lines help out jpythonc to figure out this very strange module + #These two lines help out jythonc to figure out this very strange module swing.__dict__['__file__'] = __file__ swing.__dict__['__jpythonc_name__'] = 'pawt.swing' Modified: branches/Release_2_2maint/jython/Lib/test/bugs/pr195.py =================================================================== --- branches/Release_2_2maint/jython/Lib/test/bugs/pr195.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Lib/test/bugs/pr195.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -3,7 +3,7 @@ from javax.swing import AbstractListModel, ComboBoxModel # Note that AbstractListModel implements ListModel, ComboBoxModel extends -# ListModel. This would cause JPython to include +# ListModel. This would cause Jython to include # (Object)ListModel.getElementAt(int) twice in the proxy class, which is # illegal. Modified: branches/Release_2_2maint/jython/Lib/test/bugs/pr235.py =================================================================== --- branches/Release_2_2maint/jython/Lib/test/bugs/pr235.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Lib/test/bugs/pr235.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,4 +1,4 @@ -# PR#235, JPython crashes (i.e. uncaught Java exception) under strange +# PR#235, Jython crashes (i.e. uncaught Java exception) under strange # (illegal) input. bogus = '''\ Modified: branches/Release_2_2maint/jython/Lib/test/test_jbasic.py =================================================================== --- branches/Release_2_2maint/jython/Lib/test/test_jbasic.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Lib/test/test_jbasic.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -110,4 +110,4 @@ b1.doClick() assert flag == 1, 'one actions per event - again' -# TBD: JPython does not properly exit after this code! +# TBD: Jython does not properly exit after this code! Modified: branches/Release_2_2maint/jython/Tools/freeze/Output.py =================================================================== --- branches/Release_2_2maint/jython/Tools/freeze/Output.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/freeze/Output.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -84,9 +84,9 @@ pass if __name__ == '__main__': - for of in [CabOutput('c:\\jpython\\test.cab')]: #DirectoryOutput('c:\\jpython\\dtest'), ZipOutput('c:\\jpython\\test.jar')]: - of.write('org.python.core.PyInteger', 'c:\\jpython\\JavaCode\\org\\python\\core\\PyInteger.class') - of.write('org.python.core.PyFloat', 'c:\\jpython\\JavaCode\\org\\python\\core\\PyFloat.class') + for of in [CabOutput('c:\\jython\\test.cab')]: #DirectoryOutput('c:\\jython\\dtest'), ZipOutput('c:\\jython\\test.jar')]: + of.write('org.python.core.PyInteger', 'c:\\jython\\JavaCode\\org\\python\\core\\PyInteger.class') + of.write('org.python.core.PyFloat', 'c:\\jython\\JavaCode\\org\\python\\core\\PyFloat.class') bytes = ByteArrayOutputStream() bytes.write(jarray.array([10]*500, 'b')) of.write('hi.there', bytes) Modified: branches/Release_2_2maint/jython/Tools/freeze/freeze.py =================================================================== --- branches/Release_2_2maint/jython/Tools/freeze/freeze.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/freeze/freeze.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -108,7 +108,7 @@ f.finish(opts.main) if opts.core: - skiplist = ['org.python.core.parser', 'org.python.core.BytecodeLoader', 'org.python.core.jpython'] + skiplist = ['org.python.core.parser', 'org.python.core.BytecodeLoader', 'org.python.core.jython'] f.addPackage(os.path.join(sys.prefix, 'JavaCode', 'org', 'python', 'core'), skiplist) f.out.close() Modified: branches/Release_2_2maint/jython/Tools/jythonc/ObjectFactory.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/ObjectFactory.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/ObjectFactory.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -334,4 +334,4 @@ print mod.attributes.keys() print mod.imports.keys() print mod - mod.dump("c:\\jpython\\tools\\jpythonc2\\test") + mod.dump("c:\\jython\\tools\\jythonc2\\test") Modified: branches/Release_2_2maint/jython/Tools/jythonc/PythonModule.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/PythonModule.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/PythonModule.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -14,7 +14,7 @@ """ class foo - class py -- what gets imported by jpython + class py -- what gets imported by jython holds all py constants One of these no matter how many classes maybe have static inner classes as well @@ -478,4 +478,4 @@ pm.packages = ['java.lang', 'java.awt'] pm.getIntegerConstant(22) pm.getStringConstant("hello world") - pm.dump("c:\\jpython\\tools\\jpythonc2") + pm.dump("c:\\jython\\tools\\jythonc2") Modified: branches/Release_2_2maint/jython/Tools/jythonc/compile.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/compile.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/compile.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -480,5 +480,5 @@ ja = JavaArchive([('org.python.core', []),]) for jc in javaclasses: ja.addClass(outdir, jc) - outjar = "c:\\jpython\\tools\\jpythonc2\\test\\t.jar" + outjar = "c:\\jython\\tools\\jythonc2\\test\\t.jar" ja.dump(outjar) Modified: branches/Release_2_2maint/jython/Tools/jythonc/jar.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/jar.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/jar.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -165,7 +165,7 @@ if __name__ == '__main__': - root = "c:\\jpython\\tools\\jpythonc2" + root = "c:\\jython\\tools\\jythonc2" ja = JavaArchive() ja.addFile(root, "jar.py") ja.addFile(root, "proxies.py") Modified: branches/Release_2_2maint/jython/Tools/jythonc/jast/Output.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/jast/Output.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/jast/Output.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -13,7 +13,7 @@ self.classname = classname self.filename = classname+'.java' - def dump(self, directory="c:\\jpython\\test\\comp"): + def dump(self, directory="c:\\jython\\test\\comp"): fp = open(os.path.join(directory, self.filename), 'w') for bit in self.text: fp.write(bit) Modified: branches/Release_2_2maint/jython/Tools/jythonc/javac.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/javac.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/javac.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -109,8 +109,8 @@ if __name__ == '__main__': - files = ["c:\\jpython\\tools\\jpythonc2\\test\\ButtonDemo.java", - "c:\\jpython\\tools\\jpythonc2\\test\\pawt.java",] + files = ["c:\\jython\\tools\\jythonc2\\test\\ButtonDemo.java", + "c:\\jython\\tools\\jythonc2\\test\\pawt.java",] print compile(files) print compile(files, ["-foo", "bar"]) Modified: branches/Release_2_2maint/jython/Tools/jythonc/jythonc.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/jythonc.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/jythonc.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,6 +1,6 @@ # Copyright (c) Corporation for National Research Initiatives -# Driver script for jpythonc2. See module main.py for details +# Driver script for jythonc2. See module main.py for details import main main.main() Modified: branches/Release_2_2maint/jython/Tools/jythonc/main.py =================================================================== --- branches/Release_2_2maint/jython/Tools/jythonc/main.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/jythonc/main.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,6 +1,6 @@ # Copyright (c) Corporation for National Research Initiatives -"""Usage: jpythonc [options] [module]* +"""Usage: jythonc [options] [module]* where options include: @@ -22,11 +22,11 @@ --core -c - Include the core JPython libraries (implies --deep) + Include the core Jython libraries (implies --deep) --all -a - Include all of the JPython libraries (implies --deep) + Include all of the Jython libraries (implies --deep) --bean jarfile -b jarfile @@ -49,12 +49,12 @@ -C path Use a different compiler than `standard' javac. If this is set to `NONE' then compile ends with .java. Alternatively, you can set the - property python.jpythonc.compiler in the registry. + property python.jythonc.compiler in the registry. --compileropts options -J options Options passed directly to the Java compiler. Alternatively, you can - set the property python.jpythonc.compileropts in the registry. + set the property python.jythonc.compileropts in the registry. --falsenames names -f names Modified: branches/Release_2_2maint/jython/Tools/mkjava.py =================================================================== --- branches/Release_2_2maint/jython/Tools/mkjava.py 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/Tools/mkjava.py 2007-09-19 11:09:34 UTC (rev 3484) @@ -22,7 +22,7 @@ if __name__ == '__main__': if len(sys.argv) != 4: - print 'usage: jpython mkjava.py java_name python_name directory' + print 'usage: jython mkjava.py java_name python_name directory' sys.exit(-1) directory = sys.argv[-1] Modified: branches/Release_2_2maint/jython/src/com/ziclix/python/sql/DataHandler.java =================================================================== --- branches/Release_2_2maint/jython/src/com/ziclix/python/sql/DataHandler.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/com/ziclix/python/sql/DataHandler.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -250,7 +250,7 @@ byte[] bytes = DataHandler.read(longvarchar); if (bytes != null) { - obj = Py.newString(new String(bytes)); + obj = Py.newString(PyString.from_bytes(bytes)); } } finally { try { Modified: branches/Release_2_2maint/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java =================================================================== --- branches/Release_2_2maint/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -66,7 +66,7 @@ String clob = (String) object.__tojava__(String.class); int length = clob.length(); - InputStream stream = new ByteArrayInputStream(clob.getBytes()); + InputStream stream = new ByteArrayInputStream(PyString.to_bytes(clob)); stream = new BufferedInputStream(stream); Modified: branches/Release_2_2maint/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java =================================================================== --- branches/Release_2_2maint/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -11,6 +11,7 @@ import com.ziclix.python.sql.DataHandler; import org.python.core.PyFile; import org.python.core.PyObject; +import org.python.core.PyString; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; @@ -59,7 +60,7 @@ } else { varchar = (String) object.__tojava__(String.class); } - InputStream stream = new ByteArrayInputStream(varchar.getBytes()); + InputStream stream = new ByteArrayInputStream(PyString.to_bytes(varchar)); stream = new BufferedInputStream(stream); Modified: branches/Release_2_2maint/jython/src/org/python/core/FilelikeInputStream.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/FilelikeInputStream.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/FilelikeInputStream.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -34,7 +34,7 @@ if(result.length() == 0) { return -1; } - System.arraycopy(result.getBytes(), 0, b, off, result.length()); + System.arraycopy(PyString.to_bytes(result), 0, b, off, result.length()); return result.length(); } Modified: branches/Release_2_2maint/jython/src/org/python/core/Options.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/Options.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/Options.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -8,7 +8,7 @@ */ public class Options { // Jython options. Some of these can be set from the command line - // options, but all can be controlled through the JPython registry + // options, but all can be controlled through the Jython registry /** * when an exception occurs in Java code, and it is not caught, should the @@ -38,7 +38,7 @@ public static boolean pollStandardIn = false; /** - * If true, JPython respects Java the accessibility flag for fields, + * If true, Jython respects Java the accessibility flag for fields, * methods, and constructors. This means you can only access public members. * Set this to false to access all members by toggling the accessible flag * on the member. Modified: branches/Release_2_2maint/jython/src/org/python/core/Py.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/Py.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/Py.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,6 +1,7 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.core; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -1698,12 +1699,14 @@ cflags); } - public static PyCode compile_flags(String data, String filename, - String type,CompilerFlags cflags) - { - return Py.compile_flags( - new java.io.ByteArrayInputStream((data+"\n\n").getBytes()), - filename, type,cflags); + public static PyCode compile_flags(String data, + String filename, + String type, + CompilerFlags cflags) { + return Py.compile_flags(new ByteArrayInputStream(PyString.to_bytes(data + "\n\n")), + filename, + type, + cflags); } public static PyObject compile_command_flags(String string, Modified: branches/Release_2_2maint/jython/src/org/python/core/PyArray.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyArray.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyArray.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -1272,7 +1272,7 @@ if((strlen % itemsize) != 0) { throw Py.ValueError("string length not a multiple of item size"); } - ByteArrayInputStream bis = new ByteArrayInputStream(input.getBytes()); + ByteArrayInputStream bis = new ByteArrayInputStream(PyString.to_bytes(input)); int origsize = delegate.getSize(); try { fromStream(bis); @@ -1676,7 +1676,7 @@ delegate.replaceSubArray(chars, start); } else { if(value instanceof PyString && type == Byte.TYPE) { - byte[] chars = value.toString().getBytes(); + byte[] chars = ((PyString)value).getBytes(); if(chars.length == stop - start && step == 1) { System.arraycopy(chars, 0, data, start, chars.length); } else { @@ -1726,8 +1726,7 @@ throw Py.TypeError("file needs to be in write or append mode"); } // write via the PyFile - String buffer = tostring(); - file.write(buffer); + file.write(tostring()); } public PyObject array_tolist(){ @@ -1806,12 +1805,6 @@ } catch(IOException e) { throw Py.IOError(e); } - try { - // The returned string is used as a Python str with values - // from 0-255. iso-8859-1 maps the byte values into that range. - return new String(bos.toByteArray(), "iso-8859-1"); - } catch (UnsupportedEncodingException e) { - throw Py.JavaError(e); - } + return PyString.from_bytes(bos.toByteArray()); } } Modified: branches/Release_2_2maint/jython/src/org/python/core/PyDictionary.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyDictionary.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyDictionary.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -899,6 +899,10 @@ return table.containsKey(key); } + public boolean __contains__(PyObject o) { + return dict___contains__(o); + } + final boolean dict___contains__(PyObject o) { return dict_has_key(o); } Modified: branches/Release_2_2maint/jython/src/org/python/core/PyFile.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyFile.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyFile.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,11 +1,15 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.core; +import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PushbackInputStream; +import java.io.RandomAccessFile; +import java.io.Writer; import java.util.LinkedList; // To do: @@ -32,66 +36,48 @@ mode.indexOf('a') >= 0; binary = mode.indexOf('b') >= 0; } - public String read(int n) throws java.io.IOException { - throw new java.io.IOException("file not open for reading"); + public String read(int n) throws IOException { + throw new IOException("file not open for reading"); } - public int read() throws java.io.IOException { - throw new java.io.IOException("file not open for reading"); + public int read() throws IOException { + throw new IOException("file not open for reading"); } - public int available() throws java.io.IOException { - throw new java.io.IOException("file not open for reading"); + public int available() throws IOException { + throw new IOException("file not open for reading"); } - public void unread(int c) throws java.io.IOException { - throw new java.io.IOException("file doesn't support unread"); + public void unread(int c) throws IOException { + throw new IOException("file doesn't support unread"); } - public void write(String s) throws java.io.IOException { - throw new java.io.IOException("file not open for writing"); + public void write(String s) throws IOException { + throw new IOException("file not open for writing"); } - public long tell() throws java.io.IOException { - throw new java.io.IOException("file doesn't support tell/seek"); + public long tell() throws IOException { + throw new IOException("file doesn't support tell/seek"); } - public void seek(long pos, int how) throws java.io.IOException { - throw new java.io.IOException("file doesn't support tell/seek"); + public void seek(long pos, int how) throws IOException { + throw new IOException("file doesn't support tell/seek"); } - public void flush() throws java.io.IOException { + public void flush() throws IOException { } - public void close() throws java.io.IOException { + public void close() throws IOException { } - public void truncate(long position) throws java.io.IOException { - throw new java.io.IOException("file doesn't support truncate"); + public void truncate(long position) throws IOException { + throw new IOException("file doesn't support truncate"); } public Object __tojava__(Class cls) throws IOException { return null; } - protected byte[] getBytes(String s) { - // Yes, I known the method is depricated, but it is the fastest - // way of converting between between byte[] and String - if (binary) { - byte[] buf = new byte[s.length()]; - s.getBytes(0, s.length(), buf, 0); - return buf; - } else - return s.getBytes(); - } - protected String getString(byte[] buf, int offset, int len) { - // Yes, I known the method is depricated, but it is the fastest - // way of converting between between byte[] and String - if (binary) { - return new String(buf, 0, offset, len); - } else - return new String(buf, offset, len); - } } private static class InputStreamWrapper extends FileWrapper { - java.io.InputStream istream; + InputStream istream; - public InputStreamWrapper(java.io.InputStream s) { + public InputStreamWrapper(InputStream s) { istream = s; } - public String read(int n) throws java.io.IOException { + public String read(int n) throws IOException { if (n == 0) // nothing to do return ""; @@ -100,7 +86,7 @@ byte buf[] = new byte[1024]; StringBuffer sbuf = new StringBuffer(); for (int read=0; read >= 0; read=istream.read(buf)) - sbuf.append(getString(buf, 0, read)); + sbuf.append(PyString.from_bytes(buf, 0, read)); return sbuf.toString(); } // read the next chunk available, but make sure it's at least @@ -113,22 +99,22 @@ if (read < 0) // EOF encountered return ""; - return new String(buf, 0, 0, read); + return PyString.from_bytes(buf, 0, read); } - public int read() throws java.io.IOException { + public int read() throws IOException { return istream.read(); } - public int available() throws java.io.IOException { + public int available() throws IOException { return istream.available(); } - public void unread(int c) throws java.io.IOException { - ((java.io.PushbackInputStream)istream).unread(c); + public void unread(int c) throws IOException { + ((PushbackInputStream)istream).unread(c); } - public void close() throws java.io.IOException { + public void close() throws IOException { istream.close(); } @@ -140,16 +126,16 @@ } private static class OutputStreamWrapper extends FileWrapper { - private java.io.OutputStream ostream; + private OutputStream ostream; - public OutputStreamWrapper(java.io.OutputStream s) { + public OutputStreamWrapper(OutputStream s) { ostream = s; } private static final int MAX_WRITE = 30000; - public void write(String s) throws java.io.IOException { - byte[] bytes = getBytes(s); + public void write(String s) throws IOException { + byte[] bytes = PyString.to_bytes(s); int n = bytes.length; int i = 0; while (i < n) { @@ -160,11 +146,11 @@ } } - public void flush() throws java.io.IOException { + public void flush() throws IOException { ostream.flush(); } - public void close() throws java.io.IOException { + public void close() throws IOException { ostream.close(); } @@ -176,23 +162,23 @@ } private static class IOStreamWrapper extends InputStreamWrapper { - private java.io.OutputStream ostream; + private OutputStream ostream; - public IOStreamWrapper(java.io.InputStream istream, - java.io.OutputStream ostream) { + public IOStreamWrapper(InputStream istream, + OutputStream ostream) { super(istream); this.ostream = ostream; } - public void write(String s) throws java.io.IOException { - ostream.write(getBytes(s)); + public void write(String s) throws IOException { + ostream.write(PyString.to_bytes(s)); } - public void flush() throws java.io.IOException { + public void flush() throws IOException { ostream.flush(); } - public void close() throws java.io.IOException { + public void close() throws IOException { ostream.close(); istream.close(); } @@ -205,23 +191,23 @@ } private static class WriterWrapper extends FileWrapper { - private java.io.Writer writer; + private Writer writer; - public WriterWrapper(java.io.Writer s) { + public WriterWrapper(Writer s) { writer = s; } //private static final int MAX_WRITE = 30000; - public void write(String s) throws java.io.IOException { + public void write(String s) throws IOException { writer.write(s); } - public void flush() throws java.io.IOException { + public void flush() throws IOException { writer.flush(); } - public void close() throws java.io.IOException { + public void close() throws IOException { writer.close(); } } @@ -230,8 +216,8 @@ /** The default buffer size, in bytes. */ protected static final int defaultBufferSize = 4096; - /** The underlying java.io.RandomAccessFile. */ - protected java.io.RandomAccessFile file; + /** The underlying RandomAccessFile. */ + protected RandomAccessFile file; /** The offset in bytes from the file start, of the next read or * write operation. */ @@ -260,11 +246,11 @@ /** True if the data in the buffer has been modified. */ boolean bufferModified = false; - public RFileWrapper(java.io.RandomAccessFile file) { + public RFileWrapper(RandomAccessFile file) { this(file, 8092); } - public RFileWrapper(java.io.RandomAccessFile file, int bufferSize) { + public RFileWrapper(RandomAccessFile file, int bufferSize) { this.file = file; bufferStart = 0; dataEnd = 0; @@ -274,7 +260,7 @@ endOfFile = false; } - public String read(int n) throws java.io.IOException { + public String read(int n) throws IOException { if (n < 0) { n = (int)(file.length() - filePosition); if (n < 0) @@ -284,7 +270,7 @@ n = readBytes(buf, 0, n); if (n < 0) n = 0; - return getString(buf, 0, n); + return PyString.from_bytes(buf, 0, n); } @@ -346,7 +332,7 @@ } - public int read() throws java.io.IOException { + public int read() throws IOException { // If the file position is within the data, return the byte... if (filePosition < dataEnd) { return (int)(buffer[(int)(filePosition++ - bufferStart)] @@ -361,16 +347,16 @@ } } - public int available() throws java.io.IOException { + public int available() throws IOException { return 1; } - public void unread(int c) throws java.io.IOException { + public void unread(int c) throws IOException { filePosition--; } - public void write(String s) throws java.io.IOException { - byte[] b = getBytes(s); + public void write(String s) throws IOException { + byte[] b = PyString.to_bytes(s); int len = b.length; // If the amount of data is small (less than a full buffer)... @@ -421,11 +407,11 @@ } } - public long tell() throws java.io.IOException { + public long tell() throws IOException { return filePosition; } - public void seek(long pos, int how) throws java.io.IOException { + public void seek(long pos, int how) throws IOException { if (how == 1) pos += filePosition; else if (how == 2) @@ -462,14 +448,14 @@ dataEnd = bufferStart + dataSize; } - public void flush() throws java.io.IOException { + public void flush() throws IOException { file.seek(bufferStart); file.write(buffer, 0, dataSize); bufferModified = false; file.getFD().sync(); } - public void close() throws java.io.IOException { + public void close() throws IOException { if (writing && bufferModified) { file.seek(bufferStart); file.write(buffer, 0, (int)dataSize); @@ -478,7 +464,7 @@ file.close(); } - public void truncate(long position) throws java.io.IOException { + public void truncate(long position) throws IOException { flush(); try { // file.setLength(position); @@ -519,7 +505,7 @@ sep_is_nl = (sep == "\n"); } - public String read(int n) throws java.io.IOException { + public String read(int n) throws IOException { String s = this.file.read(n); int index = s.indexOf('\r'); if (index < 0) @@ -544,7 +530,7 @@ return buf.toString(); } - public int read() throws java.io.IOException { + public int read() throws IOException { int c = file.read(); if (c != '\r') return c; @@ -556,7 +542,7 @@ return '\n'; } - public void write(String s) throws java.io.IOException { + public void write(String s) throws IOException { if (!sep_is_nl) { int index = s.indexOf('\n'); if (index >= 0) { @@ -575,23 +561,23 @@ this.file.write(s); } - public long tell() throws java.io.IOException { + public long tell() throws IOException { return file.tell(); } - public void seek(long pos, int how) throws java.io.IOException { + public void seek(long pos, int how) throws IOException { file.seek(pos, how); } - public void flush() throws java.io.IOException { + public void flush() throws IOException { file.flush(); } - public void close() throws java.io.IOException { + public void close() throws IOException { file.close(); } - public void truncate(long position) throws java.io.IOException { + public void truncate(long position) throws IOException { file.truncate(position); } @@ -1082,13 +1068,13 @@ private FileWrapper file; - private static java.io.InputStream _pb(java.io.InputStream s, String mode) + private static InputStream _pb(InputStream s, String mode) { if (mode.indexOf('b') < 0) { - if(s instanceof java.io.PushbackInputStream) { + if(s instanceof PushbackInputStream) { return s; } - return new java.io.PushbackInputStream(s); + return new PushbackInputStream(s); } return s; } @@ -1127,67 +1113,67 @@ } } - public PyFile(java.io.InputStream istream, java.io.OutputStream ostream, + public PyFile(InputStream istream, OutputStream ostream, String name, String mode) { this(new IOStreamWrapper(_pb(istream, mode), ostream), name, mode); } - public PyFile(java.io.InputStream istream, java.io.OutputStream ostream, + public PyFile(InputStream istream, OutputStream ostream, String name) { this(istream, ostream, name, "r+"); } - public PyFile(java.io.InputStream istream, java.io.OutputStream ostream) { + public PyFile(InputStream istream, OutputStream ostream) { this(istream, ostream, "<???>", "r+"); } - public PyFile(java.io.InputStream istream, String name, String mode) { + public PyFile(InputStream istream, String name, String mode) { this(new InputStreamWrapper(_pb(istream, mode)), name, mode); } - public PyFile(java.io.InputStream istream, String name) { + public PyFile(InputStream istream, String name) { this(istream, name, "r"); } - public PyFile(java.io.InputStream istream) { + public PyFile(InputStream istream) { this(istream, "<???>", "r"); } - public PyFile(java.io.OutputStream ostream, String name, String mode) { + public PyFile(OutputStream ostream, String name, String mode) { this(new OutputStreamWrapper(ostream), name, mode); } - public PyFile(java.io.OutputStream ostream, String name) { + public PyFile(OutputStream ostream, String name) { this(ostream, name, "w"); } - public PyFile(java.io.OutputStream ostream) { + public PyFile(OutputStream ostream) { this(ostream, "<???>", "w"); } - public PyFile(java.io.Writer ostream, String name, String mode) { + public PyFile(Writer ostream, String name, String mode) { this(new WriterWrapper(ostream), name, mode); } - public PyFile(java.io.Writer ostream, String name) { + public PyFile(Writer ostream, String name) { this(ostream, name, "w"); } - public PyFile(java.io.Writer ostream) { + public PyFile(Writer ostream) { this(ostream, "<???>", "w"); } - public PyFile(java.io.RandomAccessFile file, String name, String mode) { + public PyFile(RandomAccessFile file, String name, String mode) { this(new RFileWrapper(file), name, mode); } - public PyFile(java.io.RandomAccessFile file, String name) { + public PyFile(RandomAccessFile file, String name) { this(file, name, "r+"); } - public PyFile(java.io.RandomAccessFile file) { + public PyFile(RandomAccessFile file) { this(file, "<???>", "r+"); } @@ -1209,7 +1195,7 @@ Object o = null; try { o = file.__tojava__(cls); - } catch (java.io.IOException exc) { } + } catch (IOException exc) { } if (o == null) o = super.__tojava__(cls); return o; @@ -1239,27 +1225,27 @@ } else if (c1 == 'w' || c1 == 'a') jmode = "rw"; try { - java.io.File f = new java.io.File(name); + File f = new File(name); if (c1 == 'r') { if (!f.exists()) { - throw new java.io.IOException("No such file or directory: " + name); + throw new IOException("No such file or directory: " + name); } } if (c1 == 'w') { // Hack to truncate the file without deleting it: // create a FileOutputStream for it and close it again. - java.io.FileOutputStream fo = new java.io.FileOutputStream(f); + FileOutputStream fo = new FileOutputStream(f); fo.close(); fo = null; } // What about bufsize? - java.io.RandomAccessFile rfile = - new java.io.RandomAccessFile(f, jmode); + RandomAccessFile rfile = + new RandomAccessFile(f, jmode); RFileWrapper iofile = new RFileWrapper(rfile); if (c1 == 'a') iofile.seek(0, 2); return iofile; - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1281,7 +1267,7 @@ break; } } - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } return data.toString(); @@ -1307,7 +1293,7 @@ int c; try { c = file.read(); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } if (c < 0) @@ -1406,7 +1392,7 @@ try { file.write(s); softspace = false; - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1436,7 +1422,7 @@ err_closed(); try { return file.tell(); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1450,7 +1436,7 @@ err_closed(); try { file.seek(pos, how); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1472,7 +1458,7 @@ err_closed(); try { file.flush(); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1488,7 +1474,7 @@ } else { try { file.close(); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1503,7 +1489,7 @@ final void file_truncate() { try { file.truncate(file.tell()); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1515,7 +1501,7 @@ final void file_truncate(long position) { try { file.truncate(position); - } catch (java.io.IOException e) { + } catch (IOException e) { throw Py.IOError(e); } } @@ -1527,7 +1513,7 @@ // TBD: should this be removed? I think it's better to raise an // AttributeError than an IOError here. public PyObject fileno() { - throw Py.IOError("fileno() is not supported in jpython"); + throw Py.IOError("fileno() is not supported in jython"); } final String file_toString() { @@ -1616,7 +1602,7 @@ public void _close(){ try { fw.close(); - } catch(java.io.IOException e) { + } catch(IOException e) { throw Py.IOError(e); } finally { fw = null; @@ -1654,6 +1640,4 @@ } } } - - } Modified: branches/Release_2_2maint/jython/src/org/python/core/PyFunction.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyFunction.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyFunction.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -78,7 +78,7 @@ public void __setattr__(String name, PyObject value) { // TBD: in CPython, func_defaults, func_doc, __doc__ are // writable. For now, only func_doc, __doc__ are writable in - // JPython. + // Jython. if (name == "func_doc" || name == "__doc__") __doc__ = value; else if (name == "func_closure") { Modified: branches/Release_2_2maint/jython/src/org/python/core/PyString.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyString.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyString.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -2001,21 +2001,41 @@ return cached_hashcode; } - private byte[] getBytes() { - return to_bytes(string); + /** + * @return a byte array with one byte for each char in this object's + * underlying String. Each byte contains the low-order bits of its + * corresponding char. + */ + public byte[] getBytes() { + return to_bytes(string); } + + /** + * @return a byte array with one byte for each char in s. Each byte contains + * the low-order bits of its corresponding char. + */ + public static byte[] to_bytes(String s) { + int len = s.length(); + byte[] b = new byte[len]; + s.getBytes(0, len, b, 0); + return b; + } + + /** + * @return A String with chars corresponding to the bytes in buf + */ + public static String from_bytes(byte[] buf) { + return from_bytes(buf, 0, buf.length); + } - public static byte[] to_bytes(String s){ - byte[] bytes = new byte[s.length()]; - for(int i = 0; i < bytes.length; i++) { - char c = s.charAt(i); - if(c < 256){ - bytes[i] = (byte)c; - }else{ - throw Py.ValueError("Strings added to sha hashes must not contain characters with value > 255"); - } - } - return bytes; + /** + * @return A String of len buff with chars corresponding to buf from off to + * off + len + */ + public static String from_bytes(byte[] buf, int off, int len) { + // Yes, I known the method is deprecated, but it is the fastest + // way of converting between between byte[] and String + return new String(buf, 0, off, len); } public Object __tojava__(Class c) { @@ -3093,7 +3113,7 @@ if (i > 0){ buf.append(string); } - buf.append(obj.__str__()); + buf.append(((PyString)obj).string); } if(needsUnicode || this instanceof PyUnicode){ return new PyUnicode(buf.toString()); Modified: branches/Release_2_2maint/jython/src/org/python/core/PySystemState.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PySystemState.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PySystemState.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -464,7 +464,7 @@ standalone = isStandalone(jarFileName); } - // initialize the JPython registry + // initialize the Jython registry initRegistry(preProperties, postProperties, standalone, jarFileName); // other initializations Modified: branches/Release_2_2maint/jython/src/org/python/core/PyTableCode.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyTableCode.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyTableCode.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -169,7 +169,7 @@ // Handle trace function for debugging PySystemState ss = ts.systemState; if (ss.tracefunc != null) { - // JPython and CPython differ here. CPython actually lays down + // Jython and CPython differ here. CPython actually lays down // an extra SET_LINENO bytecode for function definition line. // This is ostensibly so that a tuple unpacking failure in // argument passing gets the right line number in the @@ -177,7 +177,7 @@ // you'll see two 'line' events, one for the def line and then // immediately after, one for the first line of the function. // - // JPython on the other hand only lays down a call in the + // Jython on the other hand only lays down a call in the // generated Java function to set the line number for the first // line of the function (i.e. not the def line). This // difference in behavior doesn't seem to affect arg tuple Modified: branches/Release_2_2maint/jython/src/org/python/core/PyUnicode.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/PyUnicode.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/PyUnicode.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -1473,7 +1473,7 @@ return new PyUnicode(""); } if (S instanceof PyUnicode) { - return S; + return new PyUnicode(((PyUnicode)S).string); } if (S instanceof PyString) { return new PyUnicode(codecs.decode((PyString)S, encoding, errors)); @@ -1512,7 +1512,7 @@ } public PyString unicode___str__() { - return new PyString(toString()); + return new PyString(encode()); } final int unicode___len__() { Modified: branches/Release_2_2maint/jython/src/org/python/core/StdoutWrapper.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/StdoutWrapper.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/StdoutWrapper.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -71,7 +71,7 @@ } public void write(byte[] data, int off, int len) { - write(new String(data, off, len)); + write(PyString.from_bytes(data, off, len)); } public void clearSoftspace() { Modified: branches/Release_2_2maint/jython/src/org/python/core/parser.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/core/parser.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/core/parser.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,9 +1,23 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.core; -import org.python.parser.*; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.FilterReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; + +import org.python.parser.IParserHost; +import org.python.parser.Node; +import org.python.parser.ParseException; +import org.python.parser.PythonGrammar; +import org.python.parser.ReaderCharStream; +import org.python.parser.Token; +import org.python.parser.TokenMgrError; import org.python.parser.ast.modType; -import java.io.*; /** * Facade for the classes in the org.python.parser package. @@ -75,7 +89,7 @@ public static Node parse(String string, String kind) { - return parse(new ByteArrayInputStream(string.getBytes()), + return parse(new ByteArrayInputStream(PyString.to_bytes(string)), kind, "<string>", null); } @@ -103,7 +117,7 @@ modType node = null; //System.err.println(new PyString(string).__repr__().toString()); - BufferedReader bufreader = prepBufreader(new ByteArrayInputStream(string.getBytes()), + BufferedReader bufreader = prepBufreader(new ByteArrayInputStream(PyString.to_bytes(string)), cflags); PythonGrammar g = new PythonGrammar(new ReaderCharStream(bufreader), Modified: branches/Release_2_2maint/jython/src/org/python/modules/MD5Module.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/modules/MD5Module.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/modules/MD5Module.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -1,6 +1,6 @@ // Copyright (c) Corporation for National Research Initiatives -// This is a JPython module wrapper around Harry Mantakos' md.java class, +// This is a Jython module wrapper around Harry Mantakos' md.java class, // which provides the basic MD5 algorithm. See also MD5Object.java which // is the implementation of the md5 object returned by new() and md.java // which provides the md5 implementation. Modified: branches/Release_2_2maint/jython/src/org/python/modules/SHA1.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/modules/SHA1.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/modules/SHA1.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -492,12 +492,7 @@ ); public String digest() { - byte[] digestBits = engineDigest(); - try { - return new String(digestBits, "ISO-8859-1"); - } catch (UnsupportedEncodingException exc) { - throw Py.ValueError("encoding not supported"); - } + return PyString.from_bytes(engineDigest()); } // XXX should become PyObject and use Py.idstr? Modified: branches/Release_2_2maint/jython/src/org/python/modules/Setup.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/modules/Setup.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/modules/Setup.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -21,7 +21,7 @@ // The module `name' is removed from the list of builtin modules // // That isn't very useful here, but you can add additional builtin - // modules by editing the JPython registry file. See the property + // modules by editing the Jython registry file. See the property // python.modules.builtin for details. public static String[] builtinModules = { Modified: branches/Release_2_2maint/jython/src/org/python/modules/binascii.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/modules/binascii.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/modules/binascii.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -189,8 +189,7 @@ }; private static byte[] table_b2a_hqx = - "!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr". - getBytes(); + PyString.to_bytes("!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr"); @@ -212,8 +211,7 @@ private static int BASE64_MAXBIN = 57; private static byte[] table_b2a_base64 = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/". - getBytes(); + PyString.to_bytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); Modified: branches/Release_2_2maint/jython/src/org/python/modules/imp.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/modules/imp.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/modules/imp.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -19,7 +19,7 @@ * A bogus implementation of the CPython builtin module "imp". * Only the functions required by IDLE and PMW are implemented. * Luckily these function are also the only function that IMO can - * be implemented under JPython. + * be implemented under Jython. */ public class imp { Modified: branches/Release_2_2maint/jython/src/org/python/modules/time/Time.java =================================================================== --- branches/Release_2_2maint/jython/src/org/python/modules/time/Time.java 2007-09-19 10:48:52 UTC (rev 3483) +++ branches/Release_2_2maint/jython/src/org/python/modules/time/Time.java 2007-09-19 11:09:34 UTC (rev 3484) @@ -565,7 +565,7 @@ // properties and is "en_US" by default, at least around // here! Locale "en_US" differs from locale "C" in the way // it represents dates and times. Eventually we might want - // to craft a "C" locale for Java and set JPython to use + // to craft a "C" locale for Java and set Jython to use // this by default, but that's too much work right now. // // For now, we hard code %x and %X to return values Modified: branches/Release_2_2maint/jython/src/org/python/util/InteractiveInterpreter.java ========================================... [truncated message content] |