You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Samuele P. <ped...@us...> - 2001-02-01 14:26:50
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9063 Modified Files: jreload.py Log Message: jreload ver = 0.3 Index: jreload.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/jreload.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** jreload.py 2001/02/01 01:49:13 1.3 --- jreload.py 2001/02/01 14:26:51 1.4 *************** *** 1,5 **** # java classes reload support (experimental) # Copyright 2000 Samuele Pedroni - # ?? doc + examples pending # ?? could have problem with import pkg.jclass.inner (this should not be used in any case) --- 1,4 ---- *************** *** 7,11 **** # cannot be fixed => anyway import * is not for production code ! __version__ = "0.2" import sys --- 6,10 ---- # cannot be fixed => anyway import * is not for production code ! __version__ = "0.3" import sys |
From: Finn B. <bc...@us...> - 2001-02-01 14:22:12
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv8125 Modified Files: Makefile Log Message: Added NEWS. Ensure that the NEWS.html gets generated by default. Index: Makefile =================================================================== RCS file: /cvsroot/jython/htdocs/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile 2000/12/31 13:40:32 1.2 --- Makefile 2001/02/01 14:22:12 1.3 *************** *** 21,25 **** MacOS_Install4.html \ MacOS_Install5.html \ ! all: $(HTMLFILES) --- 21,25 ---- MacOS_Install4.html \ MacOS_Install5.html \ ! NEWS.html all: $(HTMLFILES) |
From: Finn B. <bc...@us...> - 2001-02-01 14:21:15
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv8053 Modified Files: NEWS Log Message: Some news. Index: NEWS =================================================================== RCS file: /cvsroot/jython/jython/NEWS,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -r2.25 -r2.26 *** NEWS 2001/01/17 16:54:44 2.25 --- NEWS 2001/02/01 14:21:16 2.26 *************** *** 1,4 **** --- 1,23 ---- Jython NEWS + xx-xxx-2001 Jython 2.1 alpha 1 + + New features. + - Improve speed when indexing a string and iterating over a string + in a for loop. + - Reworked coercing model (pep-0208) + - Added {}.popitem(). + - Improved speed for python files by buffering the RandomAccessFile. + - Added function attributes (pep-0232) + - Rich comparison (pep-0207) + - Updated cPickle to handle CPython compatible unicode strings. + - Updated sre to CPython-2.1a1 + - Added the "new" module + + Bug fixes. + - Allow self referencing adapters to be collected when using weak + tables. + - Added workaround for a reader bug in MRJ22Jitc.01. + 17-Jan-2001 Jython 2.0 final release |
From: Finn B. <bc...@us...> - 2001-02-01 14:16:45
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv6669 Modified Files: parser.java Log Message: Attempt to work around a bug in MRJ2.1 for mac. Sometimes reader.read(..) returns a large negative numbers. Experiments done by Frode Reinsnes indicate that this should help. So far this is not made conditional on a registry entry. Perhaps it should be. Index: parser.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/parser.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** parser.java 1999/05/17 19:59:43 2.4 --- parser.java 2001/02/01 14:16:44 2.5 *************** *** 6,17 **** public class parser { ! public static String getLine(InputStream istream, int line) { ! if (istream == null) return ""; try { String text=null; - DataInputStream s = new DataInputStream(istream); for(int i=0; i <line; i++) { ! text = s.readLine(); } return text; --- 6,16 ---- public class parser { ! public static String getLine(BufferedReader reader, int line) { ! if (reader == null) return ""; try { String text=null; for(int i=0; i <line; i++) { ! text = reader.readLine(); } return text; *************** *** 21,31 **** } ! static PyException fixParseError(InputStream istream, Throwable t, String filename) { ! return fixParseError(istream, t, filename, false); } ! static PyException fixParseError(InputStream istream, Throwable t, String filename, boolean forceNewline) { --- 20,30 ---- } ! static PyException fixParseError(BufferedReader reader, Throwable t, String filename) { ! return fixParseError(reader, t, filename, false); } ! static PyException fixParseError(BufferedReader reader, Throwable t, String filename, boolean forceNewline) { *************** *** 39,43 **** line = tok.next.beginLine; } ! String text=getLine(istream, line); return new PySyntaxError(e.getMessage(), line, col, text, filename, forceNewline); --- 38,42 ---- line = tok.next.beginLine; } ! String text=getLine(reader, line); return new PySyntaxError(e.getMessage(), line, col, text, filename, forceNewline); *************** *** 50,54 **** int line = e.errorLine; //System.err.println("eof seen: "+eofSeen+", "+e.curChar+", "+col+", "+line); ! String text = getLine(istream, line); if (eofSeen) col -= 1; --- 49,53 ---- int line = e.errorLine; //System.err.println("eof seen: "+eofSeen+", "+e.curChar+", "+col+", "+line); ! String text = getLine(reader, line); if (eofSeen) col -= 1; *************** *** 67,73 **** String filename) { - if (!istream.markSupported()) { - istream = new BufferedInputStream(istream); - } int nbytes; try { --- 66,69 ---- *************** *** 81,87 **** if (nbytes > 100000) nbytes = 100000; ! //System.err.println("marking istream"); ! istream.mark(nbytes); ! PythonGrammar g = new PythonGrammar(istream); SimpleNode node = null; try { --- 77,92 ---- if (nbytes > 100000) nbytes = 100000; ! ! Reader reader = new InputStreamReader(istream); ! //if (Options.fixMacReaderBug); ! reader = new FixMacReaderBug(reader); ! ! BufferedReader bufreader = new BufferedReader(reader); ! ! try { ! bufreader.mark(nbytes); ! } catch (IOException exc) { } ! ! PythonGrammar g = new PythonGrammar(bufreader); SimpleNode node = null; try { *************** *** 102,107 **** try { //System.err.println("resetting istream"); ! istream.reset(); ! throw fixParseError(istream, t, filename, g.token_source.forcedNewline); } --- 107,112 ---- try { //System.err.println("resetting istream"); ! bufreader.reset(); ! throw fixParseError(bufreader, t, filename, g.token_source.forcedNewline); } *************** *** 136,139 **** --- 141,162 ---- } return node; + } + } + + + /** + * A workaround for a bug in MRJ2.2's FileReader, where the value returned + * from read(b, o, l) sometimes are wrong. + */ + class FixMacReaderBug extends FilterReader { + public FixMacReaderBug(Reader in) { + super(in); + } + + public int read(char b[], int off, int len) throws IOException { + int l = super.read(b, off, len); + if (l < -1) + l += off; + return l; } } |
From: Finn B. <bc...@us...> - 2001-02-01 13:48:43
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv512 Modified Files: _jython.java Log Message: Consistent formatting. Last line must end with a linebreak. Index: _jython.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/_jython.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** _jython.java 2001/01/17 02:21:09 2.1 --- _jython.java 2001/02/01 13:48:45 2.2 *************** *** 27,29 **** } ! } \ No newline at end of file --- 27,29 ---- } ! } |
From: Finn B. <bc...@us...> - 2001-02-01 13:48:25
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv401 Modified Files: AutoInternalTables.java InternalTables.java InternalTables1.java PyFinalizableInstance.java SoftIInternalTables.java ThreadStateMapping2.java WeakInternalTables.java codecs.java Log Message: Consistent formatting. Last line must end with a linebreak. Index: AutoInternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/AutoInternalTables.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** AutoInternalTables.java 2000/12/31 02:56:55 2.2 --- AutoInternalTables.java 2001/02/01 13:48:26 2.3 *************** *** 150,152 **** } ! } \ No newline at end of file --- 150,152 ---- } ! } Index: InternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** InternalTables.java 2000/12/31 02:56:55 2.4 --- InternalTables.java 2001/02/01 13:48:26 2.5 *************** *** 94,96 **** } ! } \ No newline at end of file --- 94,96 ---- } ! } Index: InternalTables1.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables1.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** InternalTables1.java 2000/12/16 16:43:33 2.2 --- InternalTables1.java 2001/02/01 13:48:26 2.3 *************** *** 203,205 **** adapters = new Hashtable(); } ! } \ No newline at end of file --- 203,205 ---- adapters = new Hashtable(); } ! } Index: PyFinalizableInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFinalizableInstance.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** PyFinalizableInstance.java 2000/09/27 21:12:52 2.1 --- PyFinalizableInstance.java 2001/02/01 13:48:26 2.2 *************** *** 16,18 **** __class__.__del__.__call__(this); } ! } \ No newline at end of file --- 16,18 ---- __class__.__del__.__call__(this); } ! } Index: SoftIInternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/SoftIInternalTables.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** SoftIInternalTables.java 2000/12/27 21:05:41 2.2 --- SoftIInternalTables.java 2001/02/01 13:48:26 2.3 *************** *** 32,34 **** } ! } \ No newline at end of file --- 32,34 ---- } ! } Index: ThreadStateMapping2.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/ThreadStateMapping2.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** ThreadStateMapping2.java 2000/12/17 15:11:27 2.1 --- ThreadStateMapping2.java 2001/02/01 13:48:26 2.2 *************** *** 24,26 **** return ts; } ! } \ No newline at end of file --- 24,26 ---- return ts; } ! } Index: WeakInternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/WeakInternalTables.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** WeakInternalTables.java 2000/12/27 21:05:41 2.3 --- WeakInternalTables.java 2001/02/01 13:48:26 2.4 *************** *** 32,34 **** } ! } \ No newline at end of file --- 32,34 ---- } ! } Index: codecs.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/codecs.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** codecs.java 2001/01/21 16:24:31 2.5 --- codecs.java 2001/02/01 13:48:26 2.6 *************** *** 481,483 **** throw Py.ValueError(type + " decoding error; unknown error handling code: " + errors); } ! } \ No newline at end of file --- 481,483 ---- throw Py.ValueError(type + " decoding error; unknown error handling code: " + errors); } ! } |
From: Finn B. <bc...@us...> - 2001-02-01 13:32:29
|
Update of /cvsroot/jython/jython/Doc In directory usw-pr-cvs1:/tmp/cvs-serv29702 Modified Files: links.h Log Message: Added jreload. Index: links.h =================================================================== RCS file: /cvsroot/jython/jython/Doc/links.h,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** links.h 2001/01/16 20:36:21 2.2 --- links.h 2001/02/01 13:32:30 2.3 *************** *** 13,16 **** --- 13,17 ---- <li><a href="subclassing.html">Subclassing</a> <li><a href="jythonc.html">Building applets, servlets, beans...</a> + <li><a href="jreload.html">Reloading java classes</a> <h3>Python Docs (exits)</h3> <li><a href="http://www.python.org/doc/tut/tut.html">Python Tutorial</a> |
From: Finn B. <bc...@us...> - 2001-02-01 13:31:36
|
Update of /cvsroot/jython/htdocs/docs In directory usw-pr-cvs1:/tmp/cvs-serv29604 Modified Files: links.h Log Message: Added jreload. Index: links.h =================================================================== RCS file: /cvsroot/jython/htdocs/docs/links.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** links.h 2000/12/01 20:31:33 1.2 --- links.h 2001/02/01 13:31:38 1.3 *************** *** 21,24 **** --- 21,25 ---- <li><a href="subclassing.html">Subclassing</a> <li><a href="jythonc.html">Building applets, servlets, beans...</a> + <li><a href="jreload.html">Reloading java classes</a> <h3>Python Docs (exits)</h3> |
From: Finn B. <bc...@us...> - 2001-02-01 13:31:11
|
Update of /cvsroot/jython/htdocs/docs In directory usw-pr-cvs1:/tmp/cvs-serv29532 Modified Files: Makefile Log Message: Added jreload. Index: Makefile =================================================================== RCS file: /cvsroot/jython/htdocs/docs/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile 2001/01/18 09:43:29 1.2 --- Makefile 2001/02/01 13:31:10 1.3 *************** *** 16,19 **** --- 16,20 ---- interpreter.html \ jarray.html \ + jreload.html \ jythonc.html \ properties.html \ |
From: Finn B. <bc...@us...> - 2001-02-01 13:23:42
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv27917 Modified Files: PythonObjectInputStream.java Log Message: Consistent formatting. Last line must end with a linebreak. Index: PythonObjectInputStream.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/PythonObjectInputStream.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** PythonObjectInputStream.java 2000/12/11 18:57:03 1.6 --- PythonObjectInputStream.java 2001/02/01 13:23:41 1.7 *************** *** 55,59 **** } } - - - \ No newline at end of file --- 55,56 ---- |
From: Finn B. <bc...@us...> - 2001-02-01 13:23:22
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv27829 Modified Files: imp.java Log Message: Consistent formatting. Last line must end with a linebreak. Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/imp.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** imp.java 2000/12/23 14:04:38 2.2 --- imp.java 2001/02/01 13:23:22 2.3 *************** *** 61,63 **** } ! } \ No newline at end of file --- 61,63 ---- } ! } |
From: Finn B. <bc...@us...> - 2001-02-01 13:23:06
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv27578 Modified Files: _sre.java Log Message: Consistent formatting. Last line must end with a linebreak. Index: _sre.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/_sre.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** _sre.java 2001/01/21 14:04:32 1.3 --- _sre.java 2001/02/01 13:23:06 1.4 *************** *** 52,54 **** return SRE_STATE.getlower(ch, flags); } ! } \ No newline at end of file --- 52,54 ---- return SRE_STATE.getlower(ch, flags); } ! } |
From: Finn B. <bc...@us...> - 2001-02-01 13:21:06
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv27153 Modified Files: Setup.java Log Message: Added the "new" module. Index: Setup.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/Setup.java,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -r2.14 -r2.15 *** Setup.java 2001/01/17 02:21:09 2.14 --- Setup.java 2001/02/01 13:21:07 2.15 *************** *** 50,53 **** --- 50,54 ---- "ucnhash", "_jython", + "new:org.python.modules.newmodule", }; } |
From: Finn B. <bc...@us...> - 2001-02-01 13:20:50
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv27081 Added Files: newmodule.java Log Message: First version. --- NEW FILE --- //copyright 2001 Finn Bock package org.python.modules; import org.python.core.*; public class newmodule { public static PyInstance instance(PyClass cls) { return new PyInstance(cls); } public static PyInstance instance(PyClass cls, PyObject dict) { if (dict == Py.None) return new PyInstance(cls); else return new PyInstance(cls, dict); } public static PyMethod instancemethod(PyObject func, PyObject instance, PyClass clss) { return new PyMethod(instance, func, clss); } public static PyFunction function(PyCode code, PyObject globals) { return function(code, globals, null, Py.EmptyObjects); } public static PyFunction function(PyCode code, PyObject globals, String name) { return function(code, globals, name, Py.EmptyObjects); } public static PyFunction function(PyCode code, PyObject globals, String name, PyObject[] argdefs) { PyFunction f = new PyFunction(globals, argdefs, code, null); if (name != null) f.__name__ = name; return f; } public static PyModule module(String name) { return new PyModule(name, null); } public static PyClass classobj(String name, PyTuple bases, PyObject dict) { return new PyClass(name, bases, dict); } } |
From: Finn B. <bc...@us...> - 2001-02-01 13:19:19
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26557 Modified Files: __builtin__.java Log Message: Speed improvement for id(). This also allow the test_funcattrs test to pass. This is a little bit like cheating since funcattrs on native methods still isn't handled gracefully. Index: __builtin__.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/__builtin__.java,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -r2.24 -r2.25 *** __builtin__.java 2001/01/21 14:00:33 2.24 --- __builtin__.java 2001/02/01 13:19:20 2.25 *************** *** 44,47 **** --- 44,49 ---- case 8: return __builtin__.tuple(arg1); + case 11: + return Py.newInteger(__builtin__.id(arg1)); default: throw argCountError(1); *************** *** 122,125 **** --- 124,128 ---- dict.__setitem__("apply", new BuiltinFunctions("apply", 9, 2, 3)); dict.__setitem__("isinstance", new BuiltinFunctions("isinstance", 10, 2)); // ?? for jreload + dict.__setitem__("id", new BuiltinFunctions("id", 11, 1)); dict.__setitem__("__import__", new ImportFunction()); } |
From: Finn B. <bc...@us...> - 2001-02-01 13:17:10
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26381 Modified Files: PyFunction.java PyMethod.java Log Message: Support for Function Attributes (pep-0232). Index: PyFunction.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFunction.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** PyFunction.java 2000/10/01 17:57:03 2.4 --- PyFunction.java 2001/02/01 13:17:09 2.5 *************** *** 9,12 **** --- 9,13 ---- public PyObject[] func_defaults; public PyCode func_code; + public PyObject __dict__; public PyFunction(PyObject globals, PyObject[] defaults, PyCode code, *************** *** 29,33 **** private static final String[] __members__ = { "__doc__", "func_doc", ! "__name__", "func_name", "func_globals", "func_defaults", "func_code" }; --- 30,34 ---- private static final String[] __members__ = { "__doc__", "func_doc", ! "__name__", "func_name", "__dict__", "func_globals", "func_defaults", "func_code" }; *************** *** 37,41 **** for (int i = 0; i < __members__.length; i++) members[i] = new PyString(__members__[i]); ! return new PyList(members); } --- 38,45 ---- for (int i = 0; i < __members__.length; i++) members[i] = new PyString(__members__[i]); ! PyList ret = new PyList(members); ! addKeys(ret, "__dict__"); ! ret.sort(); ! return ret; } *************** *** 56,65 **** // func_code // func_defaults ! else throwReadonly(name); } public void __delattr__(String name) { // TBD: should __doc__ be del'able? ! throwReadonly(name); } --- 60,96 ---- // func_code // func_defaults ! else if (name == "func_defaults") ! throwReadonly(name); ! else if (name == "func_code") { ! if (value instanceof PyCode) ! func_code = (PyCode) value; ! else ! throw Py.TypeError("func_code must be set to a code object"); ! } else if (name == "__dict__" || name == "func_dict") { ! if (value instanceof PyDictionary || value instanceof PyStringMap) ! __dict__ = value; ! else if (value == Py.None) ! __dict__ = null; ! else ! throw Py.TypeError("func_dict must be set to a dict object"); ! } else { ! if (__dict__ == null) ! __dict__ = new PyStringMap(); ! __dict__.__setitem__(name, value); ! } } public void __delattr__(String name) { // TBD: should __doc__ be del'able? ! if (name == "__dict__" || name == "func_dict") { ! __dict__ = null; ! return; ! } else if (name == "func_defaults") { ! func_defaults = Py.EmptyObjects; ! return; ! } ! if (__dict__ == null) ! throw Py.AttributeError(name); ! __dict__.__delitem__(name); } *************** *** 78,81 **** --- 109,122 ---- return Py.None; return new PyTuple(func_defaults); + } + if (name == "__dict__") { + if (__dict__ == null) + __dict__ = new PyStringMap(); + return __dict__; + } + if (__dict__ != null) { + PyObject ret = __dict__.__finditem__(name); + if (ret != null) + return ret; } return super.__findattr__(name); Index: PyMethod.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyMethod.java,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** PyMethod.java 2001/01/21 16:18:56 2.8 --- PyMethod.java 2001/02/01 13:17:09 2.9 *************** *** 34,38 **** private static final String[] __members__ = { "im_self", "im_func", "im_class", ! "__doc__", "__name__" }; --- 34,38 ---- private static final String[] __members__ = { "im_self", "im_func", "im_class", ! "__doc__", "__name__", "__dict__", }; *************** *** 42,46 **** for (int i = 0; i < __members__.length; i++) members[i] = new PyString(__members__[i]); ! return new PyList(members); } --- 42,49 ---- for (int i = 0; i < __members__.length; i++) members[i] = new PyString(__members__[i]); ! PyList ret = new PyList(members); ! PyObject k = im_func.__getattr__("__dict__").invoke("keys"); ! ret.extend(k); ! return ret; } *************** *** 52,62 **** } public void __setattr__(String name, PyObject value) { ! // no writable attributes ! throwReadonly(name); } public void __delattr__(String name) { ! throwReadonly(name); } --- 55,73 ---- } + public PyObject __findattr__(String name) { + PyObject ret = super.__findattr__(name); + if (ret != null) + return ret; + return im_func.__findattr__(name); + } + public void __setattr__(String name, PyObject value) { ! if (im_self != null) ! throw Py.TypeError("cannot set attributes through bound methods"); ! im_func.__setattr__(name, value); } public void __delattr__(String name) { ! im_func.__delattr__(name); } *************** *** 67,70 **** --- 78,83 ---- public PyObject _doget(PyObject container, PyObject wherefound) { /* Only if classes are compatible */ + if (container == null) + return this; if (__builtin__.issubclass(container.__class__, (PyClass)im_class)) if (im_func instanceof PyFunction) |
From: Finn B. <bc...@us...> - 2001-02-01 13:14:28
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv25856 Modified Files: PyFile.java Log Message: writelines(): Allow other sequence arguments than lists. Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** PyFile.java 2001/02/01 13:11:02 2.12 --- PyFile.java 2001/02/01 13:14:28 2.13 *************** *** 803,810 **** } ! public void writelines(PyList a) { ! int n = a.__len__(); ! for (int i = 0; i < n; i++) ! write(a.__getitem__(i).toString()); } --- 803,813 ---- } ! public void writelines(PyObject a) { ! PyObject item = null; ! for (int i = 0; (item = a.__finditem__(i)) != null; i++) { ! if (!(item instanceof PyString)) ! throw Py.TypeError("writelines() argument must be a sequence of strings"); ! write(item.toString()); ! } } |
From: Finn B. <bc...@us...> - 2001-02-01 13:11:04
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv25402 Modified Files: PyFile.java Log Message: Added buffering to improve performance for python files. Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** PyFile.java 2000/12/04 21:51:57 2.11 --- PyFile.java 2001/02/01 13:11:02 2.12 *************** *** 216,223 **** private static class RFileWrapper extends FileWrapper { ! java.io.RandomAccessFile file; public RFileWrapper(java.io.RandomAccessFile file) { this.file = file; } --- 216,264 ---- private static class RFileWrapper extends FileWrapper { ! /** The default buffer size, in bytes. */ ! protected static final int defaultBufferSize = 4096; + /** The underlying java.io.RandomAccessFile. */ + protected java.io.RandomAccessFile file; + + /** The offset in bytes from the file start, of the next read or + * write operation. */ + protected long filePosition; + + /** The buffer used to load the data. */ + protected byte buffer[]; + + /** The offset in bytes of the start of the buffer, from the start + * of the file. */ + protected long bufferStart; + + /** The offset in bytes of the end of the data in the buffer, from + * the start of the file. This can be calculated from + * <code>bufferStart + dataSize</code>, but it is cached to speed + * up the read( ) method. */ + protected long dataEnd; + + /** The size of the data stored in the buffer, in bytes. This may be + * less than the size of the buffer.*/ + protected int dataSize; + + /** True if we are at the end of the file. */ + protected boolean endOfFile; + + /** True if the data in the buffer has been modified. */ + boolean bufferModified = false; + public RFileWrapper(java.io.RandomAccessFile file) { + this(file, 8092); + } + + public RFileWrapper(java.io.RandomAccessFile file, int bufferSize) { this.file = file; + bufferStart = 0; + dataEnd = 0; + dataSize = 0; + filePosition = 0; + buffer = new byte[bufferSize]; + endOfFile = false; } *************** *** 229,233 **** } byte[] buf = new byte[n]; ! n = file.read(buf); if (n < 0) n = 0; --- 270,274 ---- } byte[] buf = new byte[n]; ! n = readBytes(buf, 0, n); if (n < 0) n = 0; *************** *** 235,240 **** } public int read() throws java.io.IOException { ! return file.read(); } --- 276,348 ---- } + + private int readBytes( byte b[], int off, int len ) + throws IOException + { + // Check for end of file. + if( endOfFile ) + return -1; + + // See how many bytes are available in the buffer - if none, + // seek to the file position to update the buffer and try again. + int bytesAvailable = (int)(dataEnd - filePosition); + if (bytesAvailable < 1) { + seek(filePosition, 0); + return readBytes( b, off, len ); + } + + // Copy as much as we can. + int copyLength = (bytesAvailable >= len) ? len : bytesAvailable; + System.arraycopy(buffer, (int)(filePosition - bufferStart), + b, off, copyLength); + filePosition += copyLength; + + // If there is more to copy... + if (copyLength < len) { + int extraCopy = len - copyLength; + + // If the amount remaining is more than a buffer's length, read it + // directly from the file. + if (extraCopy > buffer.length) { + file.seek(filePosition); + extraCopy = file.read( b, off + copyLength, len - copyLength ); + } else { + // ...or read a new buffer full, and copy as much as possible... + seek(filePosition, 0); + if (!endOfFile) { + extraCopy = (extraCopy > dataSize) ? dataSize : extraCopy; + System.arraycopy(buffer, 0, b, off + copyLength, extraCopy); + } else { + extraCopy = -1; + } + } + + // If we did manage to copy any more, update the file position and + // return the amount copied. + if (extraCopy > 0) { + filePosition += extraCopy; + return copyLength + extraCopy; + } + } + + // Return the amount copied. + return copyLength; + } + + public int read() throws java.io.IOException { ! // If the file position is within the data, return the byte... ! if (filePosition < dataEnd) { ! return (int)(buffer[(int)(filePosition++ - bufferStart)] & 0xff); ! ! // ...or should we indicate EOF... ! } else if (endOfFile) { ! return -1; ! ! // ...or seek to fill the buffer, and try again. ! } else { ! seek(filePosition, 0); ! return read(); ! } } *************** *** 244,256 **** public void unread(int c) throws java.io.IOException { ! file.seek(file.getFilePointer() - 1); } public void write(String s) throws java.io.IOException { ! file.write(getBytes(s)); } public long tell() throws java.io.IOException { ! return file.getFilePointer(); } --- 352,409 ---- public void unread(int c) throws java.io.IOException { ! filePosition--; } public void write(String s) throws java.io.IOException { ! byte[] b = getBytes(s); ! int len = b.length; ! ! // If the amount of data is small (less than a full buffer)... ! if (len < buffer.length) { ! // If any of the data fits within the buffer... ! int spaceInBuffer = 0; ! int copyLength = 0; ! if (filePosition >= bufferStart) ! spaceInBuffer = (int)((bufferStart + buffer.length) - filePosition); ! if (spaceInBuffer > 0) { ! // Copy as much as possible to the buffer. ! copyLength = (spaceInBuffer > len) ? len : spaceInBuffer; ! System.arraycopy(b, 0, buffer, ! (int)(filePosition - bufferStart), copyLength ); ! bufferModified = true; ! long myDataEnd = filePosition + copyLength; ! dataEnd = myDataEnd > dataEnd ? myDataEnd : dataEnd; ! dataSize = (int)(dataEnd - bufferStart); ! filePosition += copyLength; ! } ! ! // If there is any data remaining, move to the new position and copy to ! // the new buffer. ! if (copyLength < len) { ! seek(filePosition, 0); ! System.arraycopy(b, copyLength, buffer, ! (int)(filePosition - bufferStart), ! len - copyLength); ! bufferModified = true; ! long myDataEnd = filePosition + (len - copyLength); ! dataEnd = myDataEnd > dataEnd ? myDataEnd : dataEnd; ! dataSize = (int)(dataEnd - bufferStart); ! filePosition += (len - copyLength); ! } ! } else { ! // ...or write a lot of data... ! ! // Flush the current buffer, and write this data to the file. ! if (bufferModified) { ! flush( ); ! bufferStart = dataEnd = dataSize = 0; ! } ! file.write( b, 0, len ); ! filePosition += len; ! } } public long tell() throws java.io.IOException { ! return filePosition; } *************** *** 262,273 **** --- 415,460 ---- if (pos < 0) pos = 0; + + // If the seek is into the buffer, just update the file pointer. + if (pos >= bufferStart && pos < dataEnd) { + filePosition = pos; + return; + } + + // If the current buffer is modified, write it to disk. + if (bufferModified) + flush(); + + // Move to the position on the disk. file.seek(pos); + filePosition = file.getFilePointer(); + bufferStart = filePosition; + + // Fill the buffer from the disk. + dataSize = file.read(buffer); + if (dataSize < 0) { + dataSize = 0; + endOfFile = true; + } else { + endOfFile = false; + } + + // Cache the position of the buffer end. + dataEnd = bufferStart + dataSize; } public void flush() throws java.io.IOException { + file.seek(bufferStart); + file.write(buffer, 0, dataSize); + bufferModified = false; file.getFD().sync(); } public void close() throws java.io.IOException { + if (writing && bufferModified) { + file.seek(bufferStart); + file.write(buffer, 0, (int)dataSize); + } + file.close(); } *************** *** 520,524 **** } // What about bufsize? ! java.io.RandomAccessFile rfile = new java.io.RandomAccessFile(f, jmode); if (c1 == 'a') --- 707,711 ---- } // What about bufsize? ! java.io.RandomAccessFile rfile = new java.io.RandomAccessFile(f, jmode); if (c1 == 'a') |
From: Finn B. <bc...@us...> - 2001-02-01 13:08:13
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv24998 Modified Files: PyDictionary.java PyStringMap.java Log Message: Added .popitem() to dictionaries. Index: PyDictionary.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyDictionary.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** PyDictionary.java 2000/11/19 22:32:45 2.10 --- PyDictionary.java 2001/02/01 13:08:13 2.11 *************** *** 34,37 **** --- 34,39 ---- case 7: return dict.values(); + case 8: + return dict.popitem(); default: throw argCountError(0); *************** *** 115,123 **** dict.__setitem__("keys", new DictFuncs("keys", 6, 0)); dict.__setitem__("values", new DictFuncs("values", 7, 0)); dict.__setitem__("__cmp__", new DictFuncs("__cmp__", 11, 1)); dict.__setitem__("has_key", new DictFuncs("has_key", 12, 1)); dict.__setitem__("get", new DictFuncs("get", 13, 1, 2)); dict.__setitem__("update", new DictFuncs("update", 14, 1)); ! // Hide thse from Python dict.__setitem__("__finditem__", null); dict.__setitem__("__setitem__", null); --- 117,126 ---- dict.__setitem__("keys", new DictFuncs("keys", 6, 0)); dict.__setitem__("values", new DictFuncs("values", 7, 0)); + dict.__setitem__("popitem", new DictFuncs("popitem", 8, 0)); dict.__setitem__("__cmp__", new DictFuncs("__cmp__", 11, 1)); dict.__setitem__("has_key", new DictFuncs("has_key", 12, 1)); dict.__setitem__("get", new DictFuncs("get", 13, 1, 2)); dict.__setitem__("update", new DictFuncs("update", 14, 1)); ! // Hide these from Python dict.__setitem__("__finditem__", null); dict.__setitem__("__setitem__", null); *************** *** 276,279 **** --- 279,292 ---- __setitem__(key, o = failobj); return o; + } + + public PyObject popitem() { + java.util.Enumeration keys = table.keys(); + if (!keys.hasMoreElements()) + throw Py.KeyError("popitem(): dictionary is empty"); + PyObject key = (PyObject) keys.nextElement(); + PyObject val = (PyObject) table.get(key); + table.remove(key); + return new PyTuple(new PyObject[] { key, val }); } Index: PyStringMap.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyStringMap.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** PyStringMap.java 2000/09/28 13:38:38 2.6 --- PyStringMap.java 2001/02/01 13:08:13 2.7 *************** *** 17,20 **** --- 17,21 ---- private transient int filled; private transient int prime; + private transient int popfinger; /* Override serialization behavior */ *************** *** 376,379 **** --- 377,411 ---- __setitem__(key, o = failobj); return o; + } + + + public synchronized PyObject popitem() { + if (size == 0) + throw Py.KeyError("popitem(): dictionary is empty"); + + String[] table = keys; + int maxindex = table.length; + int index = popfinger; + + if (index >= maxindex || index < 0) + index = 1; + while (true) { + String tKey = table[index]; + if (tKey != null && tKey != "<deleted key>") + break; + index++; + if (index >= maxindex) + index = 0; + } + + popfinger = index + 1; + PyObject key = Py.newString(table[index]); + PyObject val = (PyObject) values[index]; + + table[index] = "<deleted key>"; + values[index] = null; + size--; + + return new PyTuple(new PyObject[] { key, val }); } |
From: Samuele P. <ped...@us...> - 2001-02-01 02:16:18
|
Update of /cvsroot/jython/jython/Doc In directory usw-pr-cvs1:/tmp/cvs-serv27638 Modified Files: jreload.ht Log Message: hoops Index: jreload.ht =================================================================== RCS file: /cvsroot/jython/jython/Doc/jreload.ht,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** jreload.ht 2001/02/01 02:02:06 1.1 --- jreload.ht 2001/02/01 02:16:17 1.2 *************** *** 117,123 **** in an internal table. This is also good because building the wrappers is expensive. </p> ! <p>Note: Unless one cannot predict the amount of reloading ! that will be performed by an application or for the case of long-running ! highly dynamic apps, the unloading issue can simply be ignored. </p> <p>Clearly the entries somehow block unloading. On the other hand --- 117,123 ---- in an internal table. This is also good because building the wrappers is expensive. </p> ! <p>Note: Typically one should care about java classes unloading only for very dynamic applications, like ! IDEs or long-running apps, that would go out memory if old versions of reloaded classes would not be ! collected. </p> <p>Clearly the entries somehow block unloading. On the other hand |
From: Samuele P. <ped...@us...> - 2001-02-01 02:02:07
|
Update of /cvsroot/jython/jython/Doc In directory usw-pr-cvs1:/tmp/cvs-serv24594 Added Files: jreload.ht Log Message: jreload, internalTablesImpl and jclass unloading doc --- NEW FILE --- Title: Java Reload (experimental) simple Support <h3>Java Reload (experimental) simple Support - JReload</h3> <h4>Introduction and usage, plus some notes on java classes unloading and internalTablesImpl option</h4> <p> The "jreload" module is not the definitive word about java classes reloading under jython. It is still experimental and its interface may improve or change to become more pythonic. </p> <p> "jreload" cannot cover all the possible reload-flavors, and its goal is to offer a simple interface for the most common cases, e.g. quick trial-and-error experimenting. </p> <p> Java classes reloading in jython is not enabled by "jreload", some of the modifications occurred to jython run-time have made it possible. Now jython can deal with java classes with the same name (without clashes) and run-time supports unloading of java classes by different ways, which is a must feature for some uses of reloading</p> <p><i>[The expert user can now play directly with class-loaders and reloading as he would from java.] </i></p> <p>The main idea of the "jreload" interface is that of a load-set. A load-set is a package-like object that can host a complete hierarchy of java packages, which can be reloaded as a whole.</p> <p><i>Why there is no support for reloading a single class? Java classes are loaded through class-loaders, actually there is no support in java to redefine an already loaded class through its class-loader. In order to reload a class one should create a new class-loader, but classes from different class-loaders cannot interoperate, so we need to reload all related classes through the new class-loader. Note: The normal python reload built-in does nothing for java classes and simply returns the old version. </i></p> <p> The "jreload" module exports the following functions: </p> <blockquote></pre> makeLoadSet(name, path)<br> reload(loadSet) </pre></blockquote> <p>makeLoadSet creates and returns a new load-set with the given name. The created load-set will behave like a package and import statement related to it can be issued. name should be a valid python identifier like any python module name and should not clash with any module that has been or will be imported. Internally the created load-set will be added to sys.modules, the same way it happens to modules on import. You can issue the same makeLoadSet from many places, it is idempotent like modules imports are. </p> <p>path should be a list of directory or jar paths. The created load-set will enable importing the classes present there. path should be disjoint from both sys.path and java classpath, otherwise one can get very confusing results. </p> <p><i>For example: if a load-set 'X' is created and its hierarchy contains java packages 'p' and 'p.q', then the following references can be used in import statements: 'X', 'X.p', 'X.p.q'.</i></p> <p> reload(loadSet) reloads all the classes in the package hierarchy hosted by loadSet and returns loadSet.</p> <p><i>Note: The current version of "jreload" (jreload.__version__=='0.3') does not support removing or substituting jars on the fly.</i></p> <!--table-stop--> <a name="example"><h3>Example</h3></a> <p>The following example should help make things clearer: (its files should be present in the jython Demo dir)</p> <li> Demo/jreload/example.jar contains example.Version <a href="#jarVersion">(source)</a> and example.PrintVer <a href="#PrintVer">(source)</a></li> <li> Demo/jreload/_xample contains a slightly modified version of example.Version <a href="#newVersion">(source)</a></li> <pre> >>> import sys >>> import os >>> import jreload >>> def xp(name): return os.path.join(sys.prefix,'Demo/jreload/'+name) # builds a path under 'Demo/jreload' ... >>> X=jreload.makeLoadSet('X',[xp('.'),xp('example.jar')]) >>> from X import example >>> dir(example) ['PrintVer', 'Version', '__name__'] >>> X.example.Version <jclass example.Version at 6781345> >>> from X.example import * # works but in general import * from java pkgs is not for production code >>> v=Version(1) >>> PrintVer.print(v) version 1 >>> os.rename(xp('_xample'),xp('example')) # _xample becomes example, hiding and "patching" jar contents >>> jreload.reload(X) # (re)loads example dir example.Version and jar example.PrintVer <java load-set X> >>> nv2=example.Version(2) >>> example.PrintVer.print(nv2) new version 2 >>> PrintVer.print(nv2) Traceback (innermost last): File "<console>", line 1, in ? TypeError: print(): 1st arg can't be coerced to example.Version >>> example.PrintVer.print(v) Traceback (innermost last): File "<console>", line 1, in ? TypeError: print(): 1st arg can't be coerced to example.Version >>> os.rename(xp('example'),xp('_xample')) </pre> <p>Note: Differently from python packages reload, load-sets reload the complete hosted hierarchy. <br> Note: Class versions across reloads are not interoperable. </p> <p>Like for python classes and python reload, old versions are kept around, if there are still references to them. But what happens if they are no longer used?</p> <a name="unload" ><h3>Java Classes Unloading</h3></a> <p>One would expect that no longer referenced java classes would be unloaded, but the situation is not that simple.</p> <p>In order to give a python-class-like view on python side and for implementation reasons jython wraps java classes (in instances of org.python.core.PyJavaClass). Clearly the mapping from java classes to their wrapped version should be unique (e.g. to guarantee == and 'is' semantic). So jython keeps this mapping in an internal table. This is also good because building the wrappers is expensive. </p> <p>Note: Unless one cannot predict the amount of reloading that will be performed by an application or for the case of long-running highly dynamic apps, the unloading issue can simply be ignored. </p> <p>Clearly the entries somehow block unloading. On the other hand java classes unloading is just a memory consumption optimization (and as such is it presented in Java Language Specification). Actual jvms clearly support this. JPython simply kept the entries in the table forever but Jython and "jreload" try to make unloading possible.</p> <p><i>Note: java never unloads system classes (java.* etc) nor classes from classpath. Further Jython cannot unload sys.path java classes. So the whole unload issue makes sense only with "jreload" or custom class-loaders.</i></p> <h4>Java 2 and jython internalTablesImpl option</h4> <p>Under java2 jython offers table implementations that exploit soft/weak references in order to discard entries (when this is OK) for unloading.</p> <p>A possible policy would be to keep an entry as long as the corresponding java class is still referenced outside the table (both by java or jython code). But this one cannot be implemented. <i>[Tech.: One cannot add fields to final java class java.lang.Class!]</i> So entries are kept as long as the wrapped version is still in use.</p> These implementations can be chosen trough python.options.internalTablesImpl registry option. Note: they only influence classes unloading, there is no need and reason to use them, unless one depends on class unloading to avoid memory leakage. <p><b>internalTablesImpl = weak -- </b>Sets implementation using weak-refs. Table entries for not referenced (outside the table) wrapped versions are "discarded" at garbage collection points. If a class or some of its instances are continuously passed from java to jython side, but no long-living reference to it is kept from jython side, this can imply a performance penalty (rebuilding the wrapped version is expensive). On the other hand this is a good setting for testing if unloading actually happens or some references hunting around prevent it. </p> <p><i>[Note: With jdk 1.3 java -verbose:class can help tracking class unloads, and System.gc forces class unloading. With jdk 1.2 java -verbose:gc should give some information on class unloading, but unloading of classes happen at unpredictable points and System.gc does not trigger it. Also weak-refs allow testing for unloading and gc.] </i></p> <p><b>internalTablesImpl = soft --</b>Sets implementation using soft-refs. Table entries for not referenced (outside the table) wrapped versions are "discarded" on memory shortage, given soft-reference definition. Soft-references behavior is not specified in full details, so the actual behavior will depend on the concrete jvm. But if actual (jvm) implementations are not too bad, this should be a good setting for production code, which relies on unloading to avoid out of memory failures. </p> <h4>Java 1.1</h4> <p>To be honest the unloading support that jython can offer under java 1.1 (given the absence of weak/soft-refs) is error-prone and anything serious would require "too much" caution, <i>but this should not be a real issue</i>. Support is offered only for "jreload" needs, in these forms:<p> <li>Before reload(X) one can issue X.unload(). X.unload() discards all the entries for the old versions of the classes in X. This is safe only if all python subclasses and all instances of them have been destroyed.</li> <li>One can "extract" the information needed in order to discard the entries for the versions actually present in X at a later point (after a whole series of reloads): <blockquote><pre> u_t1=X.unload # extract unload info for time t1 versions ... reloads ... u_t1() # discard entries for time t1 versions </pre></blockquote> u_t1() is safe only if at that point all subclasses/instances of the involved versions have been destroyed. </li> <p><i>Note: these idioms work also with the standard internal tables implementation under java2, and for compatibility even with the weak/soft implementations.</i></p> <h3>JReload Example Source Files</h3> <a name="jarVersion"><h4>Jar example.Version</h4></a> <pre> package example; public class Version { private int ver; public Version(int ver) { this.ver = ver; } public String toString() { return "version "+ver; } } </pre> <a href="#example">Back to example transcript</a> <a name="PrintVer"><h4>example.PrintVer</h4></a> <pre> package example; public class PrintVer { static public void print(Version ver) { System.out.println(ver); } } </pre> <a href="#example">Back to example transcript</a> <a name="newVersion"><h4>New example.Version</h4></a> <pre> package example; public class Version { private int ver; public Version(int ver) { this.ver = ver; } public String toString() { return "new version "+ver; } } </pre> <a href="#example">Back to example transcript</a> |
From: Samuele P. <ped...@us...> - 2001-02-01 01:56:55
|
Update of /cvsroot/jython/jython/Demo/jreload/src/example In directory usw-pr-cvs1:/tmp/cvs-serv23048/jreload/src/example Added Files: PrintVer.java jar-Version.java new-Version.java Log Message: jreload Demo --- NEW FILE --- package example; public class PrintVer { static public void print(Version ver) { System.out.println(ver); } } --- NEW FILE --- package example; public class Version { private int ver; public Version(int ver) { this.ver = ver; } public String toString() { return "version "+ver; } } --- NEW FILE --- package example; public class Version { private int ver; public Version(int ver) { this.ver = ver; } public String toString() { return "new version "+ver; } } |
From: Samuele P. <ped...@us...> - 2001-02-01 01:56:55
|
Update of /cvsroot/jython/jython/Demo/jreload/_xample In directory usw-pr-cvs1:/tmp/cvs-serv23048/jreload/_xample Added Files: Version.class Log Message: jreload Demo --- NEW FILE --- Êþº¾ SourceFile *· |
From: Samuele P. <ped...@us...> - 2001-02-01 01:56:54
|
Update of /cvsroot/jython/jython/Demo/jreload In directory usw-pr-cvs1:/tmp/cvs-serv23048/jreload Added Files: example.jar Log Message: jreload Demo --- NEW FILE --- PK ?* ?* ?* ?*¤sbD |
From: Samuele P. <ped...@us...> - 2001-02-01 01:54:36
|
Update of /cvsroot/jython/jython/Demo/jreload/src/example In directory usw-pr-cvs1:/tmp/cvs-serv22249/example Log Message: Directory /cvsroot/jython/jython/Demo/jreload/src/example added to the repository |