From: <pj...@us...> - 2008-09-24 19:44:31
|
Revision: 5343 http://jython.svn.sourceforge.net/jython/?rev=5343&view=rev Author: pjenvey Date: 2008-09-24 19:44:25 +0000 (Wed, 24 Sep 2008) Log Message: ----------- it's more correct for StdoutWrapper to write the object being printed to the file instead of __str__'ing it refs #1130 Modified Paths: -------------- trunk/jython/src/org/python/core/PyFile.java trunk/jython/src/org/python/core/StdoutWrapper.java Modified: trunk/jython/src/org/python/core/PyFile.java =================================================================== --- trunk/jython/src/org/python/core/PyFile.java 2008-09-21 00:20:23 UTC (rev 5342) +++ trunk/jython/src/org/python/core/PyFile.java 2008-09-24 19:44:25 UTC (rev 5343) @@ -411,6 +411,10 @@ } } + public void write(PyObject o) { + file_write(o); + } + final synchronized void file_write(String s) { checkClosed(); softspace = false; Modified: trunk/jython/src/org/python/core/StdoutWrapper.java =================================================================== --- trunk/jython/src/org/python/core/StdoutWrapper.java 2008-09-21 00:20:23 UTC (rev 5342) +++ trunk/jython/src/org/python/core/StdoutWrapper.java 2008-09-24 19:44:25 UTC (rev 5343) @@ -105,11 +105,10 @@ file.write(" "); file.softspace = false; } - PyString string = o.__str__(); - String s = string.toString(); - int len = s.length(); - file.write(s); + file.write(o); if (o instanceof PyString) { + String s = o.toString(); + int len = s.length(); if (len == 0 || !Character.isWhitespace(s.charAt(len - 1)) || s.charAt(len - 1) == ' ') { file.softspace = space; @@ -128,11 +127,10 @@ obj.invoke("write", Py.Space); obj.__setattr__("softspace", Py.Zero); } - PyString string = o.__str__(); - String s = o.toString(); - int len = s.length(); - obj.invoke("write", string); + obj.invoke("write", o); if (o instanceof PyString) { + String s = o.toString(); + int len = s.length(); if (len == 0 || !Character.isWhitespace(s.charAt(len - 1)) || s.charAt(len - 1) == ' ') { obj.__setattr__("softspace", space ? Py.One : Py.Zero); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |