Update of /cvsroot/jython/jython/org/python/core
In directory usw-pr-cvs1:/tmp/cvs-serv26333
Modified Files:
Py.java
Log Message:
FixedFileWrapper(): Allow using both a outputstreams and writers in the
extending print syntax:
print >>outputstream, "hello world"
Index: Py.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -r2.34 -r2.35
*** Py.java 2001/02/02 09:28:36 2.34
--- Py.java 2001/02/04 15:07:32 2.35
***************
*** 1556,1559 ****
--- 1556,1573 ----
name = "fixed file";
this.file = file;
+
+ if (file instanceof PyJavaInstance) {
+ Object tmp = file.__tojava__(OutputStream.class);
+ if ((tmp != Py.NoConversion) && (tmp != null)) {
+ OutputStream os = (OutputStream)tmp;
+ this.file = new PyFile(os, "<java OutputStream>");
+ } else {
+ tmp = file.__tojava__(Writer.class);
+ if ((tmp != Py.NoConversion) && (tmp != null)) {
+ Writer w = (Writer)tmp;
+ this.file = new PyFile(w, "<java Writer>");
+ }
+ }
+ }
}
|