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: Finn B. <bc...@us...> - 2001-11-14 16:25:24
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8815 Modified Files: javaos.py Log Message: Added patch by Kevin Butler that implements os.environ and os.system(). Index: javaos.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/javaos.py,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -d -r2.8 -r2.9 *** javaos.py 2001/11/03 15:51:36 2.8 --- javaos.py 2001/11/14 16:25:20 2.9 *************** *** 24,31 **** import java ! from java.io import File ! import javapath ! path = javapath error = OSError --- 24,37 ---- import java ! from java.io import File, BufferedReader, InputStreamReader ! import javapath as path ! from UserDict import UserDict ! import string ! import exceptions ! import re ! import sys ! import thread + error = OSError *************** *** 40,47 **** linesep = java.lang.System.getProperty('line.separator') - #I can do better than this... - environ = {} - - def _exit(n=0): java.lang.System.exit(n) --- 46,49 ---- *************** *** 51,79 **** return foo.getParent() def listdir(path): l = File(path).list() if l is None: ! raise OSError(0, 'No such directory', path) return list(l) def mkdir(path, mode='ignored'): if not File(path).mkdir(): ! raise OSError(0, "couldn't make directory", path) def makedirs(path, mode='ignored'): if not File(path).mkdirs(): ! raise OSError(0, "couldn't make directories", path) def remove(path): if not File(path).delete(): ! raise OSError(0, "couldn't delete file", path) def rename(path, newpath): if not File(path).renameTo(File(newpath)): ! raise OSError(0, "couldn't rename file", path) def rmdir(path): if not File(path).delete(): ! raise OSError(0, "couldn't delete directory", path) unlink = remove --- 53,84 ---- return foo.getParent() + def chdir(path): + raise OSError(0, 'chdir not supported in Java', path) + def listdir(path): l = File(path).list() if l is None: ! raise OSError(0, 'No such directory', path) return list(l) def mkdir(path, mode='ignored'): if not File(path).mkdir(): ! raise OSError(0, "couldn't make directory", path) def makedirs(path, mode='ignored'): if not File(path).mkdirs(): ! raise OSError(0, "couldn't make directories", path) def remove(path): if not File(path).delete(): ! raise OSError(0, "couldn't delete file", path) def rename(path, newpath): if not File(path).renameTo(File(newpath)): ! raise OSError(0, "couldn't rename file", path) def rmdir(path): if not File(path).delete(): ! raise OSError(0, "couldn't delete directory", path) unlink = remove *************** *** 95,97 **** --- 100,396 ---- if times and hasattr(File, "setLastModified"): File(path).setLastModified(long(times[1] * 1000.0)) + + class LazyDict( UserDict ): + """A lazy-populating User Dictionary. + Lazy initialization is not thread-safe. + """ + + def __init__( self, dict=None, populate=lambda: {}, keyTransform=None ): + """dict is the starting dictionary of values + populate is a function that returns the populated dictionary + keyTransform is a function to transform the environment keys + (e.g., upper or identity) + """ + UserDict.__init__( self, dict ) + self._populated = 0 + self.__populateFunc = populate + self._keyTransform = keyTransform or (lambda key: key) + + def __populate( self ): + if not self._populated: + # store as self.data so any 'set' sets in original as well + self.data = self.__populateFunc() + self._populated = 1 # not thread-safe! + + ########## extend methods from UserDict by pre-populating + def __repr__(self): + self.__populate() + return UserDict.__repr__( self ) + def __cmp__(self, dict): + self.__populate() + return UserDict.__cmp__( self, dict ) + def __len__(self): + self.__populate() + return UserDict.__len__( self ) + def __getitem__(self, key): + self.__populate() + return UserDict.__getitem__( self, self._keyTransform(key) ) + def __setitem__(self, key, item): + self.__populate() + UserDict.__setitem__( self, self._keyTransform(key), item ) + def __delitem__(self, key): + self.__populate() + UserDict.__delitem__( self, self._keyTransform(key) ) + def clear(self): + self.__populate() + UserDict.clear( self ) + def copy(self): + self.__populate() + return UserDict.copy( self ) + def keys(self): + self.__populate() + return UserDict.keys( self ) + def items(self): + self.__populate() + return UserDict.items( self ) + def values(self): + self.__populate() + return UserDict.values( self ) + def has_key(self, key): + self.__populate() + return UserDict.has_key( self, self._keyTransform(key) ) + def update(self, dict): + self.__populate() + UserDict.update( self, dict ) + def get(self, key, failobj=None): + self.__populate() + return UserDict.get( self, self._keyTransform(key), failobj ) + def setdefault(self, key, failobj=None): + self.__populate() + return UserDict.setdefault( self, self._keyTransform(key), failobj ) + def popitem(self): + self.__populate() + return UserDict.popitem( self ) + + + class _NullEnv: + """Placeholder Environment for platforms w/o shell or environment + functionality, like Mac""" + def __init__( self ): + self.environment = LazyDict() + + # note that this won't pass __test() + def execute( self, cmd ): + return None + + def system( self, cmd ): + raise OSError( 0, "os.system not implemented. " + "Try setting python.environment=shell.", cmd ) + return -1 + + def readLines( self, cmd ): + return [] + + class _ShellEnv: + """Environment derived by spawning a subshell and parsing its environment. + Also supports current directory and system functions. + """ + def __init__( self, cmd, getEnv, keyTransform=None ): + """cmd is a list of arguments to come before the command in the + Runtime.exec() call. + getEnv is the string system command to list the environment variables + envKeyTransform is a function to transform the environment keys + (usually toupper or identity) + """ + self.cmd = cmd + self.getEnv = getEnv + self.environment = LazyDict(populate=self._getEnvironment, + keyTransform=keyTransform) + self._keyTransform = self.environment._keyTransform + + ########## system + def system( self, cmd ): + """Act like the standard library 'system' call. + Execute a command in a shell, and send output to stdout. + """ + p = self.execute( cmd ) + + # we want intermediate output while process runs, so call + # _readLines( ... println ) + def println( arg, write=sys.stdout.write ): + write( arg + "\n" ) + # read stdin in main thread + self._readLines( p.getInputStream(), println ) + # read stderr in secondary thread + thread.start_new_thread( self._readLines, + ( p.getErrorStream(), println )) + return p.waitFor() + + + def execute( self, cmd ): + """Execute cmd in a shell, and then return the process instance""" + shellCmd = self._formatCmd( cmd ) + if self.environment._populated: + env = self._formatEnvironment( self.environment ) + else: + env = None + p = java.lang.Runtime.getRuntime().exec( shellCmd, env ) + return p + + ########## utility methods + def _readLines( self, stream, func=None ): + """Read lines of stream, and either append them to return + array of lines, or call func on each line. + """ + lines = [] + func = func or lines.append + # should read both stderror and stdout in separate threads... + bufStream = BufferedReader( InputStreamReader( stream )) + while 1: + line = bufStream.readLine() + if line is None: break + func( line ) + return lines or None + + def _formatCmd( self, cmd ): + """Format a command for execution in a shell. + """ + return self.cmd + [cmd] + + def _formatEnvironment( self, env ): + """Format enviroment in lines suitable for Runtime.exec""" + lines = [] + for keyValue in env.items(): + lines.append( "%s=%s" % keyValue ) + return lines + + def _getEnvironment( self ): + """Get the environment variables by spawning a subshell. + """ + p = self.execute( self.getEnv ) + env = {} + for line in self._readLines( p.getInputStream() ): + i = line.index( '=' ) + env[ self._keyTransform(line[:i])] = line[i+1:] + return env + + def _getOsType( os=None ): + os = os or sys.registry.getProperty( "python.os" ) or \ + java.lang.System.getProperty( "os.name" ) + + _osTypeMap = ( + ( "nt", r"(nt|Windows NT)|(Windows NT 4.0)|(WindowsNT)|" + r"(Windows 2000)|(Windows XP)|(Windows CE)" ), + ( "dos", r"(dos|Windows 95)|(Windows 98)|(Windows ME)" ), + ( "mac", r"(mac|MacOS.*)|(Darwin)" ), + ( "None", r"None" ), + ( "unix", r".*" ), # last is default, even if doesn't match + ) + for osType, pattern in _osTypeMap: + if re.match( pattern, os ): + break + + return osType + + def _getShellEnv( os = None ): + """Select the type of environment handling we want to provide. + os is None to auto-detect, or something recognized by _getOsType() + could add 'java' + """ + if os == "shell": + os = None + osType = _getOsType( os ) + if osType == "nt": + return _ShellEnv( ["cmd", "/c"], "set", string.upper ) + elif osType == "dos": + return _ShellEnv( ["command", "/c"], "set", string.upper ) + elif osType == "mac": + return _NullEnv() + else: # osType == "unix": + return _ShellEnv( ["sh", "-c"], "env" ) + + _envType = sys.registry.getProperty("python.environment", "shell") + if _envType == "shell": + _shellEnv = _getShellEnv() + else: + _shellEnv = _NullEnv() + + # provide environ, putenv, getenv + environ = _shellEnv.environment + putenv = environ.__setitem__ + getenv = environ.__getitem__ + # provide system + system = _shellEnv.system + + ########## test code + def __test( shellEnv=_shellEnv ): + # tests system and environment functionality + key, value = "testKey", "testValue" + org = environ + testCmds = [ + # test commands and regexes to match first line of expected + # output on first and second runs + # Note that the validation is incomplete for several of these + # - they should validate depending on platform and pre-post, but + # they don't. + + # no quotes, should output both words + ("echo hello there", "hello there"), + # should print PATH (on NT) + ("echo PATH=%PATH%", "(PATH=.*;.*)|(PATH=%PATH%)"), + # should print 'testKey=%testKey%' on NT before initialization, + # and 'testKey=testValue' after + ("echo %s=%%%s%%" % (key,key), + "(%s=%%%s%%)|(%s=%s)" % (key, key, key, value)), + # should print PATH (on Unix) + ( "echo PATH=$PATH", "PATH=.*" ), + # should print 'testKey=testValue' on Unix after initialization + ( "echo %s=$%s" % (key,key), + "(%s=$%s)|(%s=)|(%s=%s)" % (key, key, key, key, value ) ), + # should output quotes on NT but not on Unix + ( 'echo "hello there"', '"?hello there"?' ), + # should print 'why' to stdout. + ( r'''python -c "import sys;sys.stdout.write( 'why\n' )"''', "why" ), + # should print 'why' to stderr, but it won't right now. Have + # to add the print to give some output...empty string matches every + # thing... + ( r'''python -c "import sys;sys.stderr.write('why\n');print " ''', "" ) + ] + + assert not environ._populated, \ + "before population, environ._populated should be false" + + # test system - we should really grab the output of the system + # command, but we aren't + for cmd, pattern in testCmds: + print "\nExecuting %s with default environment" % cmd + assert not _shellEnv.system( cmd ), \ + "%s failed with default environment" % cmd + line = _shellEnv._readLines(_shellEnv.execute(cmd).getInputStream())[0] + assert re.match( pattern, line ), \ + "expected match for %s, got %s" % ( pattern, line ) + + # trigger initialization of environment + environ[ key ] = value + + assert environ._populated, \ + "after population, environ._populated should be true" + assert org.get( key, None ) == value, \ + "expected stub to have %s set" % key + assert environ.get( key, None ) == value, \ + "expected real environment to have %s set" % key + + # test system using the non-default environment - should really grab + # output, but oh, well. + for cmd, pattern in testCmds: + print "\nExecuting %s with initialized environment" % cmd + assert not _shellEnv.system( cmd ), \ + "%s failed with default environment" % cmd + line = _shellEnv._readLines(_shellEnv.execute(cmd).getInputStream())[0] + assert re.match( pattern, line ), \ + "expected match for %s, got %s" % ( pattern, line ) + + assert environ.has_key( "PATH" ), \ + "expected environment to have PATH attribute " \ + "(this may not apply to all platforms!)" |
From: Finn B. <bc...@us...> - 2001-11-09 14:50:24
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv14656 Added Files: test338.py test338cl.java test338j.java test338j1.java test338m.py Log Message: Test for "[ #480017 ] Proxy supers are loaded from syspath". --- NEW FILE: test338.py --- """ [ #480017 ] Proxy supers are loaded from syspath """ import support support.compileJava("test338cl.java", classpath=".") support.compileJava("test338j1.java", classpath=".") support.compileJava("test338j.java", classpath=".") support.runJava("test338j", classpath=".") --- NEW FILE: test338cl.java --- import java.io.*; public class test338cl extends ClassLoader { protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { //System.out.println("MyLoadClass " + name); Class c = findLoadedClass(name); if (c != null) return c; try { FileInputStream fis = new FileInputStream(name.replace('.', '/') + ".class"); int size = fis.available(); byte[] buf = new byte[size]; fis.read(buf); fis.close(); c = defineClass(name, buf, 0, buf.length); if (resolve) resolveClass(c); return c; } catch (IOException exc) { return super.loadClass(name, resolve); } } } --- NEW FILE: test338j.java --- import org.python.util.*; import org.python.core.*; public class test338j implements Runnable { public static void main(String[] args) throws Exception { //new Main().run(); Runnable r = (Runnable)Class.forName("test338j", true, new test338cl()).newInstance(); r.run(); } public void run() { String brob = "test338m"; PythonInterpreter interp = new PythonInterpreter(); //Py.getSystemState().setClassLoader(this.getClass().getClassLoader()); interp.set("test338j1", test338j1.class); //interp.exec("mod = __import__('" + brob + "')"); interp.execfile(brob + ".py"); interp.exec("cl = " + brob + "()"); Object newobj = interp.get("cl", Object.class); //System.out.println(newobj.getClass().getClassLoader()); //System.out.println(newobj.getClass().getSuperclass().hashCode() + " " + test338j1.class.hashCode()); //System.out.println(newobj.getClass().getSuperclass().getClassLoader()); test338j1 boobj = (test338j1) newobj; //System.out.println(boobj.getDescription()); } } --- NEW FILE: test338j1.java --- public class test338j1 { public String getDescription() { return "a test338j1 description"; } } --- NEW FILE: test338m.py --- #import test338j1 class test338m(test338j1): def getDescription(self): desc = test338j1.getDescription(self) # Superclass call return "Foo_" + desc |
From: Finn B. <bc...@us...> - 2001-11-08 18:50:58
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv3033 Modified Files: build.xml Log Message: Only update the NEWS.ht files when running "ant newrelease". A bare "ant" only generate the .html files based on the existing .ht files. Index: build.xml =================================================================== RCS file: /cvsroot/jython/htdocs/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.xml 2001/07/19 14:48:48 1.1 --- build.xml 2001/11/08 18:50:55 1.2 *************** *** 99,104 **** </target> ! <target name="all" depends="init, update, generate, collect"/> <target name="copy2sf" depends="init"> --- 99,105 ---- </target> ! <target name="all" depends="init, generate, collect"/> + <target name="newrelease" depends="init, update, generate, collect"/> <target name="copy2sf" depends="init"> |
From: Finn B. <bc...@us...> - 2001-11-08 18:35:44
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv30470 Modified Files: platform.ht index.ht Log Message: Fixed spelling mistakes. Thanks to rpcee for reporting this. Index: platform.ht =================================================================== RCS file: /cvsroot/jython/htdocs/platform.ht,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** platform.ht 2001/02/23 20:21:17 1.4 --- platform.ht 2001/11/08 18:35:41 1.5 *************** *** 69,73 **** JPython Runner for Macintosh</A>. ! This link also contains pointers to the lastest JVM for Macintosh. <P>Hopefully, future releases of Jython will be able to incorporate --- 69,73 ---- JPython Runner for Macintosh</A>. ! This link also contains pointers to the latest JVM for Macintosh. <P>Hopefully, future releases of Jython will be able to incorporate Index: index.ht =================================================================== RCS file: /cvsroot/jython/htdocs/index.ht,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** index.ht 2001/07/29 21:05:04 1.22 --- index.ht 2001/11/08 18:35:41 1.23 *************** *** 10,14 **** <ul> <li>What is <A HREF="docs/whatis.html">Jython</A> ! <li><A HREF="download.html">Download</a> the lastest version. <li><A HREF="docs/index.html">Documentation</A> <li>The Jython <A HREF="http://www.jython.org/cgi-bin/faqw.py?req=index">FAQ</A>. --- 10,14 ---- <ul> <li>What is <A HREF="docs/whatis.html">Jython</A> ! <li><A HREF="download.html">Download</a> the latest version. <li><A HREF="docs/index.html">Documentation</A> <li>The Jython <A HREF="http://www.jython.org/cgi-bin/faqw.py?req=index">FAQ</A>. *************** *** 21,25 **** <dl> <p><dt><b>Jython 2.1 alpha 3 released!</b> ! <dd>Download the lastest release of Jython <a href="http://sourceforge.net/project/showfiles.php?group_id=12867&release_id=45862">here</a>, or <a href="NEWS.html">read a summary</a> --- 21,25 ---- <dl> <p><dt><b>Jython 2.1 alpha 3 released!</b> ! <dd>Download the latest release of Jython <a href="http://sourceforge.net/project/showfiles.php?group_id=12867&release_id=45862">here</a>, or <a href="NEWS.html">read a summary</a> *************** *** 33,37 **** <p><dt><b>Jython 2.0 released!</b> ! <dd>Download the lastest stable relase of Jython <a href="download.html">here</a> (17-jan-2001). --- 33,37 ---- <p><dt><b>Jython 2.0 released!</b> ! <dd>Download the latest stable relase of Jython <a href="download.html">here</a> (17-jan-2001). |
From: Finn B. <bc...@us...> - 2001-11-06 16:48:40
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv22063 Modified Files: PyInstance.java Log Message: Fix for "[ #476580 ] 'del obj.non_member' : wrong exception" Catch KeyError from __delitem__ and raise a AttributeError instead. Index: PyInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInstance.java,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** PyInstance.java 2001/10/30 19:09:23 2.26 --- PyInstance.java 2001/11/06 16:48:37 2.27 *************** *** 324,328 **** deller.__call__(this, new PyString(name)); } else { ! __dict__.__delitem__(name); } } --- 324,334 ---- deller.__call__(this, new PyString(name)); } else { ! try { ! __dict__.__delitem__(name); ! } catch (PyException exc) { ! if (Py.matchException(exc, Py.KeyError)) ! throw Py.AttributeError("class " + __class__.__name__ + ! " has no attribute '" + name + "'"); ! }; } } |
From: Finn B. <bc...@us...> - 2001-11-06 16:46:03
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv20574 Added Files: test335.py Log Message: Test for "[ #476580 ] 'del obj.non_member' : wrong exception" --- NEW FILE: test335.py --- """ [ #476580 ] 'del obj.non_member' : wrong exception """ import support class C : pass o = C() try: o.foo except AttributeError: pass try: del o.foo except AttributeError: pass |
From: Finn B. <bc...@us...> - 2001-11-05 13:51:49
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv10723 Modified Files: Setup.java Log Message: Added xreadlines. Index: Setup.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/Setup.java,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** Setup.java 2001/10/28 17:13:44 2.19 --- Setup.java 2001/11/05 13:51:46 2.20 *************** *** 51,54 **** --- 51,55 ---- "new:org.python.modules.newmodule", "_weakref", + "xreadlines", }; } |
From: Finn B. <bc...@us...> - 2001-11-05 13:51:32
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv10632 Added Files: xreadlines.java Log Message: Initial version. --- NEW FILE: xreadlines.java --- // Copyright (c) 2001 Finn Bock. package org.python.modules; import org.python.core.*; public class xreadlines { private final static int CHUNKSIZE = 8192; public static PyString __doc__xreadlines = new PyString( "xreadlines(f)\n" + "\n" + "Return an xreadlines object for the file f." ); public static PyObject xreadlines$(PyObject file) { return new XReadlineObj(file); } public static class XReadlineObj extends PyObject { private PyObject file; private PyObject lines = null; private int lineslen = 0; private int lineno = 0; private int abslineno = 0; public XReadlineObj(PyObject file) { this.file = file; } public PyObject __finditem__(PyObject idx) { return __finditem__(idx.__int__().getValue()); } public PyObject __finditem__(int idx) { if (idx != abslineno) { throw Py.RuntimeError( "xreadlines object accessed out of order"); } if (lineno >= lineslen) { lines = file.invoke("readlines", Py.newInteger(CHUNKSIZE)); lineno = 0; lineslen = lines.__len__(); } abslineno++; return lines.__finditem__(lineno++); } public String toString() { return "<xreadlines object at " + Py.id(this) + ">"; } // __class__ boilerplate -- see PyObject for details public static PyClass __class__; protected PyClass getPyClass() { return __class__; } } } |
From: Finn B. <bc...@us...> - 2001-11-03 23:23:55
|
Update of /cvsroot/jython/bugtests/classes/test336p/data In directory usw-pr-cvs1:/tmp/cvs-serv6761/classes/test336p/data Added Files: MyData.java Log Message: Test for "[ #451552 ] case insensitivity on import causes prob" --- NEW FILE: MyData.java --- package test336p.data; public class MyData { } |
From: Finn B. <bc...@us...> - 2001-11-03 23:23:55
|
Update of /cvsroot/jython/bugtests/classes/test336p In directory usw-pr-cvs1:/tmp/cvs-serv6761/classes/test336p Added Files: Data.java Log Message: Test for "[ #451552 ] case insensitivity on import causes prob" --- NEW FILE: Data.java --- package test336p; public class Data { } |
From: Finn B. <bc...@us...> - 2001-11-03 23:23:54
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv6761 Added Files: test336.py Log Message: Test for "[ #451552 ] case insensitivity on import causes prob" --- NEW FILE: test336.py --- """ [ #451552 ] case insensitivity on import causes prob """ import support support.compileJava("classes/test336p/Data.java") support.compileJava("classes/test336p/data/MyData.java") from test336p.data import MyData |
From: Finn B. <bc...@us...> - 2001-11-03 23:22:38
|
Update of /cvsroot/jython/bugtests/classes/test336p/data In directory usw-pr-cvs1:/tmp/cvs-serv6626/data Log Message: Directory /cvsroot/jython/bugtests/classes/test336p/data added to the repository |
From: Finn B. <bc...@us...> - 2001-11-03 23:22:19
|
Update of /cvsroot/jython/bugtests/classes/test336p In directory usw-pr-cvs1:/tmp/cvs-serv6566/test336p Log Message: Directory /cvsroot/jython/bugtests/classes/test336p added to the repository |
From: Finn B. <bc...@us...> - 2001-11-03 19:42:43
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv28997 Modified Files: Py.java Log Message: Fix for "[ #477768 ] ord([123]) 21a3". Check for the Py.NoConversion return value from __tojava_ before casting the value. Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** Py.java 2001/11/03 19:26:02 2.52 --- Py.java 2001/11/03 19:42:40 2.53 *************** *** 1244,1251 **** if (o instanceof PyInteger) return (byte)((PyInteger)o).getValue(); ! Byte i = (Byte)o.__tojava__(Byte.TYPE); ! if (i == null) throw Py.TypeError("integer required"); ! return i.byteValue(); } public static short py2short(PyObject o) { --- 1244,1251 ---- if (o instanceof PyInteger) return (byte)((PyInteger)o).getValue(); ! Object i = o.__tojava__(Byte.TYPE); ! if (i == null || i == Py.NoConversion) throw Py.TypeError("integer required"); ! return ((Byte) i).byteValue(); } public static short py2short(PyObject o) { *************** *** 1253,1260 **** return (short)((PyInteger)o).getValue(); ! Short i = (Short)o.__tojava__(Short.TYPE); ! if (i == null) throw Py.TypeError("integer required"); ! return i.shortValue(); } --- 1253,1260 ---- return (short)((PyInteger)o).getValue(); ! Object i = o.__tojava__(Short.TYPE); ! if (i == null || i == Py.NoConversion) throw Py.TypeError("integer required"); ! return ((Short) i).shortValue(); } *************** *** 1276,1283 **** return (long)((PyInteger)o).getValue(); ! Long i = (Long)o.__tojava__(Long.TYPE); ! if (i == null) throw Py.TypeError("integer required"); ! return i.longValue(); } --- 1276,1283 ---- return (long)((PyInteger)o).getValue(); ! Object i = o.__tojava__(Long.TYPE); ! if (i == null || i == Py.NoConversion) throw Py.TypeError("integer required"); ! return ((Long) i).longValue(); } *************** *** 1288,1295 **** return (float)((PyInteger)o).getValue(); ! Float i = (Float)o.__tojava__(Float.TYPE); ! if (i == null) throw Py.TypeError("float required"); ! return i.floatValue(); } public static double py2double(PyObject o) { --- 1288,1295 ---- return (float)((PyInteger)o).getValue(); ! Object i = o.__tojava__(Float.TYPE); ! if (i == null || i == Py.NoConversion) throw Py.TypeError("float required"); ! return ((Float) i).floatValue(); } public static double py2double(PyObject o) { *************** *** 1299,1306 **** return (double)((PyInteger)o).getValue(); ! Double i = (Double)o.__tojava__(Double.TYPE); ! if (i == null) throw Py.TypeError("float required"); ! return i.doubleValue(); } --- 1299,1306 ---- return (double)((PyInteger)o).getValue(); ! Object i = o.__tojava__(Double.TYPE); ! if (i == null || i == Py.NoConversion) throw Py.TypeError("float required"); ! return ((Double) i).doubleValue(); } *************** *** 1320,1327 **** } ! Character i = (Character)o.__tojava__(Character.TYPE); ! if (i == null) throw Py.TypeError(msg); ! return i.charValue(); } --- 1320,1327 ---- } ! Object i = o.__tojava__(Character.TYPE); ! if (i == null || i == Py.NoConversion) throw Py.TypeError(msg); ! return ((Character) i).charValue(); } |
From: Finn B. <bc...@us...> - 2001-11-03 19:39:50
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv28639 Added Files: test334.py Log Message: Test for "[ #477768 ] ord([123]) 21a3". --- NEW FILE: test334.py --- """ [ #477768 ] ord([123]) 21a3 """ import support try: ord([123]) except TypeError: pass |
From: Finn B. <bc...@us...> - 2001-11-03 19:29:00
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv26706 Modified Files: NEWS Log Message: Some new news. Index: NEWS =================================================================== RCS file: /cvsroot/jython/jython/NEWS,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** NEWS 2001/07/29 20:46:49 2.36 --- NEWS 2001/11/03 19:28:57 2.37 *************** *** 1,4 **** --- 1,10 ---- Jython NEWS + xx-nov-2001 Jython 2.1 beta 1 + + New features. + - The weakref module is now available. + - The sys.exitfunc hook is called on exit. + 29-jul-2001 Jython 2.1 alpha 3 |
From: Finn B. <bc...@us...> - 2001-11-03 19:26:07
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv26183/util Modified Files: PythonInterpreter.java jython.java Log Message: Fix for "[ #476772 ] shutdowns in jython / atexit" Call sys.exitfunc when the interpreter is about to exit. Index: PythonInterpreter.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/PythonInterpreter.java,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -d -r2.8 -r2.9 *** PythonInterpreter.java 2001/10/28 17:13:44 2.8 --- PythonInterpreter.java 2001/11/03 19:26:02 2.9 *************** *** 219,221 **** --- 219,225 ---- return Py.tojava(locals.__finditem__(name.intern()), javaclass); } + + public void cleanup() { + systemState.callExitFunc(); + } } Index: jython.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/jython.java,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** jython.java 2001/10/28 17:13:44 2.20 --- jython.java 2001/11/03 19:26:02 2.21 *************** *** 166,171 **** } catch (Throwable t) { Py.printException(t); ! if (!opts.interactive) System.exit(-1); } } --- 166,173 ---- } catch (Throwable t) { Py.printException(t); ! if (!opts.interactive) { ! interp.cleanup(); System.exit(-1); + } } } *************** *** 194,197 **** --- 196,200 ---- } } + interp.cleanup(); } } |
From: Finn B. <bc...@us...> - 2001-11-03 19:26:07
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26183/core Modified Files: Py.java PySystemState.java Log Message: Fix for "[ #476772 ] shutdowns in jython / atexit" Call sys.exitfunc when the interpreter is about to exit. Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** Py.java 2001/10/28 17:13:42 2.51 --- Py.java 2001/11/03 19:26:02 2.52 *************** *** 160,163 **** --- 160,164 ---- value = tmp; } + Py.getSystemState().callExitFunc(); if (value instanceof PyInteger) { System.exit(((PyInteger)value).getValue()); *************** *** 823,828 **** --- 824,831 ---- } catch (PyException e) { Py.printException(e); + Py.getSystemState().callExitFunc(); System.exit(-1); } + Py.getSystemState().callExitFunc(); } Index: PySystemState.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PySystemState.java,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** PySystemState.java 2001/10/28 17:13:43 2.63 --- PySystemState.java 2001/11/03 19:26:02 2.64 *************** *** 629,632 **** --- 629,646 ---- sys.builtins.__setitem__("_", o); } + + public void callExitFunc() throws PyIgnoreMethodTag { + PyObject exitfunc = __findattr__("exitfunc"); + if (exitfunc != null) { + try { + exitfunc.__call__(); + } catch (PyException exc) { + if (!Py.matchException(exc, Py.SystemExit)) { + Py.println(stderr, Py.newString("Error in sys.exitfunc:")); + } + Py.printException(exc); + } + } + } } |
From: Finn B. <bc...@us...> - 2001-11-03 19:09:55
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv22235 Modified Files: support.py Log Message: runJava(), runJython(): Added "error" keyword to specify a redirect of stderr to a file. Index: support.py =================================================================== RCS file: /cvsroot/jython/bugtests/support.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** support.py 2001/10/27 22:29:47 1.3 --- support.py 2001/11/03 19:09:53 1.4 *************** *** 63,70 **** else: outstream = java.lang.System.out import java thread.start_new_thread(StreamReader, (p.inputStream, outstream)) ! thread.start_new_thread(StreamReader, (p.errorStream, outstream)) ret = p.waitFor() if ret != 0 and not kw.has_key("expectError"): --- 63,74 ---- else: outstream = java.lang.System.out + if kw.has_key("error"): + errstream = java.io.FileOutputStream(kw['error']) + else: + errstream = java.lang.System.out import java thread.start_new_thread(StreamReader, (p.inputStream, outstream)) ! thread.start_new_thread(StreamReader, (p.errorStream, errstream)) ret = p.waitFor() if ret != 0 and not kw.has_key("expectError"): *************** *** 82,89 **** else: outstream = java.lang.System.out import java thread.start_new_thread(StreamReader, (p.inputStream, outstream)) ! thread.start_new_thread(StreamReader, (p.errorStream, outstream)) ret = p.waitFor() if ret != 0 and not kw.has_key("expectError"): --- 86,97 ---- else: outstream = java.lang.System.out + if kw.has_key("error"): + errstream = java.io.FileOutputStream(kw['error']) + else: + errstream = java.lang.System.out import java thread.start_new_thread(StreamReader, (p.inputStream, outstream)) ! thread.start_new_thread(StreamReader, (p.errorStream, errstream)) ret = p.waitFor() if ret != 0 and not kw.has_key("expectError"): |
From: Finn B. <bc...@us...> - 2001-11-03 19:08:02
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv22091 Added Files: test333.py test333s1.py test333s2.py test333s3.py Log Message: Test for "[ #476772 ] shutdowns in jython / atexit" --- NEW FILE: test333.py --- """ [ #476772 ] shutdowns in jython / atexit """ import support import os def check(filename, result): f = open(filename) l = f.readlines() f.close() if l != result: raise support.TestError("Result was wrong: %s" % l) # Different exit situations in the interpreter. support.runJython("test333s1.py", output="test333s1.out") check("test333s1.out", [ "myfunc\n" ]) ret = support.runJython("test333s2.py", output="test333s2.out", expectError=1) if ret != 42: raise support.TestError("Return code was wrong: %d" % ret) check("test333s2.out", [ "myfunc\n" ]) support.runJython("test333s3.py", output="test333s3.out", error="test333s3.err", expectError=1) check("test333s3.out", [ "myfunc\n" ]) check("test333s3.err", [ 'Traceback (innermost last):\n', ' File "test333s3.py", line 8, in ?\n', 'Exc\n', ]) # Different exit situations in compiled applications. support.compileJPythonc("test333s1.py", output="test333s1.err") support.runJava("test333s1", classpath="jpywork", output="test333s1.out") check("test333s1.out", [ "myfunc\n" ]) support.compileJPythonc("test333s1.py", output="test333s3.err") support.runJava("test333s1", classpath="jpywork", output="test333s1.out") check("test333s1.out", [ "myfunc\n" ]) support.compileJPythonc("test333s3.py", output="test333s3.err") support.runJava("test333s3", classpath="jpywork", output="test333s3.out", error="test333s3.err", expectError=1) check("test333s3.out", [ "myfunc\n" ]) f = open("test333s3.err") lines = f.readlines(); f.close() if "Exc\n" not in lines: raise support.TestError("Should raise a 'Exc' exception") --- NEW FILE: test333s1.py --- import sys def myfunc(): print "myfunc" sys.exitfunc = myfunc --- NEW FILE: test333s2.py --- import sys def myfunc(): print "myfunc" sys.exitfunc = myfunc sys.exit(42) --- NEW FILE: test333s3.py --- import sys def myfunc(): print "myfunc" sys.exitfunc = myfunc raise "Exc" |
From: Finn B. <bc...@us...> - 2001-11-03 17:12:15
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23341 Modified Files: socket.py Log Message: Fix for "[ #438297 ] SimpleHTTPServer does not work" Added setsockopt() and getsockopt(). Only support for the SO_REUSEADDR option. Silently ignore the option on non-jdk1.4. Index: socket.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/socket.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** socket.py 2001/07/16 17:04:56 1.11 --- socket.py 2001/11/03 17:12:13 1.12 *************** *** 28,31 **** --- 28,33 ---- SOCK_RDM = 4 # not supported SOCK_SEQPACKET = 5 # not supported + SOL_SOCKET = 0xFFFF + SO_REUSEADDR = 4 def _gethostbyaddr(name): *************** *** 85,88 **** --- 87,91 ---- server = 0 file_count = 0 + reuse_addr = 0 def bind(self, addr, port=None): *************** *** 107,110 **** --- 110,115 ---- else: self.sock = java.net.ServerSocket(port, backlog) + if hasattr(self.sock, "setReuseAddress"): + self.sock.setReuseAddress(self.reuse_addr) def accept(self): *************** *** 132,135 **** --- 137,142 ---- def _setup(self, sock): self.sock = sock + if hasattr(self.sock, "setReuseAddress"): + self.sock.setReuseAddress(self.reuse_addr) self.istream = sock.getInputStream() self.ostream = sock.getOutputStream() *************** *** 169,172 **** --- 176,187 ---- port = self.sock.getPort() return (host, port) + + def setsockopt(self, level, optname, value): + if optname == SO_REUSEADDR: + self.reuse_addr = value + + def getsockopt(self, level, optname): + if optname == SO_REUSEADDR: + return self.reuse_addr def makefile(self, mode="r", bufsize=-1): |
From: Finn B. <bc...@us...> - 2001-11-03 16:55:34
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv20300 Added Files: test332.py Log Message: Test for [ #438297 ] SimpleHTTPServer does not work --- NEW FILE: test332.py --- """ [ #438297 ] SimpleHTTPServer does not work """ import support import sys import SimpleHTTPServer import BaseHTTPServer def test(HandlerClass = SimpleHTTPServer.SimpleHTTPRequestHandler, ServerClass = BaseHTTPServer.HTTPServer): server_address = ('', 8000) # Silense the server HandlerClass.log_message = lambda x, b, *arg: None httpd = ServerClass(server_address, HandlerClass) # do just one request. httpd.handle_request() import thread thread.start_new_thread(test, ()) import httplib import time time.sleep(5) h = httplib.HTTP() h.connect("localhost", 8000) h.putrequest('GET', "/") h.endheaders() status, reason, headers = h.getreply() if status != 200: raise support.TestError("Wrong status: %d" % status) if reason != "OK": raise support.TestError("Wrong status: %d" % status) h.getfile().read() |
From: Finn B. <bc...@us...> - 2001-11-03 15:59:27
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8506 Modified Files: javapath.py Log Message: Fix for "[ #477608 ] os.path.getmtime() missing". Added getmtime() and getatime(). The value for access time is actually the modification time (same as in the os.stat() method). Index: javapath.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/javapath.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** javapath.py 2001/07/24 20:11:16 1.6 --- javapath.py 2001/11/03 15:59:24 1.7 *************** *** 229,230 **** --- 229,241 ---- raise OSError(0, 'No such file or directory', path) return size + + def getmtime(path): + f = File(path) + return f.lastModified() / 1000.0 + + def getatime(path): + # We can't detect access time so we return modification time. This + # matches the behaviour in os.stat(). + f = File(path) + return f.lastModified() / 1000.0 + |
From: Finn B. <bc...@us...> - 2001-11-03 15:57:26
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv8363 Added Files: test331.py Log Message: Test for [ #477608 ] os.path.getmtime() missing --- NEW FILE: test331.py --- """ [ #477608 ] os.path.getmtime() missing """ import support import os s = os.stat("test331.py") if s[8] != os.path.getmtime("test331.py"): raise support.TestWarning("Modification time was wrong") if s[7] != os.path.getatime("test331.py"): raise support.TestWarning("Access time was wrong") |
From: Finn B. <bc...@us...> - 2001-11-03 15:51:44
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6878 Modified Files: javaos.py Log Message: Fix for "[ #477793 ] os.utime() is missing". Added a utime() function that can change the modification time on a file. It does not change the access time and it only works on java2. Index: javaos.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/javaos.py,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -d -r2.7 -r2.8 *** javaos.py 2001/07/16 17:04:56 2.7 --- javaos.py 2001/11/03 15:51:36 2.8 *************** *** 90,91 **** --- 90,97 ---- mtime = f.lastModified() / 1000.0 return (0, 0, 0, 0, 0, 0, size, mtime, mtime, 0) + + def utime(path, times): + # Only the modification time is changed (and only on java2). + if times and hasattr(File, "setLastModified"): + File(path).setLastModified(long(times[1] * 1000.0)) + |