Issue911242
Created on 2004-03-07.05:10:42 by anonymous, last changed 2005-07-19.02:00:05 by sf-robot.
File name |
Uploaded |
Description |
Edit |
Remove |
print-patch.zip
|
nobody,
2004-03-07.05:10:42
|
|
|
|
msg2373 (view) |
Author: Nobody/Anonymous (nobody) |
Date: 2004-03-07.05:10:42 |
|
re:
http://sourceforge.net/tracker/index.php?func=detail&aid=674932&group_id=12867&atid=112867
[Note, this patch creates a new package,
core.printhelper. cvs diff doesn't
include these so I've had to create the patch as a zip
file incorporating these
files with the diffed patch file.]
There's a couple problems with the code involved here.
First, Py.print
is wrapping the file target in a new FixedFileWrapper
with _each_ call
to print. Second, StdoutWrapper, the base class of
FFW, flushes after
each write as Samuele suspected.
- The main fix is that StdoutWrapper should inherit
from a base
class. The base class will never call flush(), but
Stdout will
continue to do so.
- renamed these *Wrapper classes to *PrintHelper
classes, because
PyFile uses FileWrapper classes to mean something
different. So
there are the base (abstract) PrintHelper class,
FixedFilePrintHelper, StdoutPrintHelper, and
StderrPrintHelper.
- PrintHelper now has static helper methods to avoid
code
duplication, e.g. instead of
public static void print(PyObject file, PyObject o) {
if (file == None)
print(o);
else
new FixedFileWrapper(file).print(o);
}
it now reads
public static void print(PyObject file, PyObject o) {
PrintHelper.getPrintHelper(file).print(o);
}
- getPrintHelper allows us to cache PrintHelper
objects so that a loop
that does 1000 prints to a file won't create 1000
PrintHelper wrappers.
Caching uses WeakHashMap so GC behavior is unchanged.
|
msg2374 (view) |
Author: Brian Zimmer (bzimmer) |
Date: 2005-07-04.18:43:22 |
|
Logged In: YES
user_id=37674
PyFile and the supporting classes changed considerably to support
new-style classes. Could you re-work this patch against the current
codebase and we'll try to apply it more quickly this time around. Thanks.
|
msg2375 (view) |
Author: SourceForge Robot (sf-robot) |
Date: 2005-07-19.02:00:05 |
|
Logged In: YES
user_id=1312539
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
|
|
Date |
User |
Action |
Args |
2004-03-07 05:10:42 | anonymous | create | |
|