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: <otm...@us...> - 2011-02-02 10:37:05
|
Revision: 7192 http://jython.svn.sourceforge.net/jython/?rev=7192&view=rev Author: otmarhumbel Date: 2011-02-02 10:36:55 +0000 (Wed, 02 Feb 2011) Log Message: ----------- prevent internal variables from being reused in subrocess calls fixes issue #1700 thanks agronholm for the analysis Modified Paths: -------------- trunk/jython/Lib/test/test_bat_jy.py trunk/jython/NEWS trunk/jython/src/shell/jython.bat Modified: trunk/jython/Lib/test/test_bat_jy.py =================================================================== --- trunk/jython/Lib/test/test_bat_jy.py 2011-01-25 23:46:27 UTC (rev 7191) +++ trunk/jython/Lib/test/test_bat_jy.py 2011-02-02 10:36:55 UTC (rev 7192) @@ -48,7 +48,7 @@ return self.process.getErrorStream() class StarterProcess: - def writeStarter(self, args, javaHome, jythonHome, jythonOpts): + def writeStarter(self, args, javaHome, jythonHome, jythonOpts, internals=False): (starter, starterPath) = tempfile.mkstemp(suffix='.bat', prefix='starter', text=True) starter.close() outfilePath = starterPath[:-4] + '.out' @@ -60,6 +60,9 @@ starter.write('set JYTHON_HOME=%s\n' % jythonHome) if jythonOpts: starter.write('set JYTHON_OPTS=%s\n' % jythonOpts) + if internals: + starter.write('set _JYTHON_OPTS=leaking_internals\n') + starter.write('set _JYTHON_HOME=c:/leaking/internals\n') starter.write(self.buildCommand(args, outfilePath)) return (starterPath, outfilePath) finally: @@ -92,9 +95,9 @@ except IllegalThreadStateException: return True - def run(self, args, javaHome, jythonHome, jythonOpts): + def run(self, args, javaHome, jythonHome, jythonOpts, internals=False): ''' creates a start script, executes it and captures the output ''' - (starterPath, outfilePath) = self.writeStarter(args, javaHome, jythonHome, jythonOpts) + (starterPath, outfilePath) = self.writeStarter(args, javaHome, jythonHome, jythonOpts, internals) try: process = Runtime.getRuntime().exec(starterPath) stdoutMonitor = StdoutMonitor(process) @@ -130,7 +133,7 @@ home = ex[:-11] # \jython.bat return home - def assertOutput(self, flags=None, javaHome=None, jythonHome=None, jythonOpts=None): + def assertOutput(self, flags=None, javaHome=None, jythonHome=None, jythonOpts=None, internals=False): args = [self.quote(sys.executable), '--print'] memory = None stack = None @@ -161,7 +164,7 @@ jythonArgs = jythonArgs.replace('%%', '%') # workaround two .bat files args.append(flag) process = StarterProcess() - out = process.run(args, javaHome, jythonHome, jythonOpts) + out = process.run(args, javaHome, jythonHome, jythonOpts, internals) self.assertNotEquals('', out) homeIdx = out.find('-Dpython.home=') java = 'java' @@ -256,7 +259,11 @@ def test_multiple(self): self.assertOutput(jythonOpts='some arbitrary options') - + +class InternalsTest(BaseTest): + def test_no_leaks(self): + self.assertOutput(internals=True) + class JavaOptsTest(BaseTest): def test_memory(self): self.assertOutput(['-J-Xmx321m']) @@ -387,6 +394,7 @@ JavaHomeTest, JythonHomeTest, JythonOptsTest, + InternalsTest, JavaOptsTest, ArgsTest, DoubleDashTest, Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-01-25 23:46:27 UTC (rev 7191) +++ trunk/jython/NEWS 2011-02-02 10:36:55 UTC (rev 7192) @@ -5,6 +5,7 @@ - [ 1667 ] thread.local subclasses with constructor params fail - [ 1698 ] warnings module fails under JSR-223 - [ 1697 ] Wrong error message when http connection can not be established + - [ 1700 ] "virtualenv is not compatible" to 2.5.2rc3 Jython 2.5.2rc3 Bugs Fixed Modified: trunk/jython/src/shell/jython.bat =================================================================== --- trunk/jython/src/shell/jython.bat 2011-01-25 23:46:27 UTC (rev 7191) +++ trunk/jython/src/shell/jython.bat 2011-02-02 10:36:55 UTC (rev 7192) @@ -24,9 +24,12 @@ rem ----- Verify and set required environment variables ----------------------- +rem make sure to clear the internal variables, to prevent leaking into subprocess calls set _JAVA_CMD=java if defined JAVA_HOME set _JAVA_CMD="%JAVA_HOME:"=%\bin\java" -if defined JYTHON_OPTS set _JYTHON_OPTS="%JYTHON_OPTS:"=%" +set _JYTHON_OPTS= +if defined JYTHON_OPTS set _JYTHON_OPTS="%JYTHON_OPTS:"=%" +set _JYTHON_HOME= if defined JYTHON_HOME set _JYTHON_HOME="%JYTHON_HOME:"=%" if defined _JYTHON_HOME goto gotHome This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <am...@us...> - 2011-01-25 23:46:33
|
Revision: 7191 http://jython.svn.sourceforge.net/jython/?rev=7191&view=rev Author: amak Date: 2011-01-25 23:46:27 +0000 (Tue, 25 Jan 2011) Log Message: ----------- 1. Re-enabling the use of IPV6/AF_INET6 addresses 2. Adding workarounds for systems that have problems with IPV6 on java 3. Test for #2 Modified Paths: -------------- trunk/jython/Lib/socket.py trunk/jython/Lib/test/test_socket.py Modified: trunk/jython/Lib/socket.py =================================================================== --- trunk/jython/Lib/socket.py 2011-01-23 15:58:55 UTC (rev 7190) +++ trunk/jython/Lib/socket.py 2011-01-25 23:46:27 UTC (rev 7191) @@ -94,29 +94,40 @@ class timeout(error): pass class sslerror(error): pass +def _unmapped_exception(exc): + return error(-1, 'Unmapped exception: %s' % exc) + +def java_net_socketexception_handler(exc): + if exc.message.startswith("Address family not supported by protocol family"): + return error(errno.EAFNOSUPPORT, 'Address family not supported by protocol family: See http://wiki.python.org/jython/NewSocketModule#IPV6addresssupport') + return _unmapped_exception(exc) + +def would_block_error(exc=None): + return error(errno.EWOULDBLOCK, 'The socket operation could not complete without blocking') + ALL = None _exception_map = { -# (<javaexception>, <circumstance>) : lambda: <code that raises the python equivalent>, or None to stub out as unmapped +# (<javaexception>, <circumstance>) : callable that raises the python equivalent exception, or None to stub out as unmapped -(java.io.IOException, ALL) : lambda: error(errno.ECONNRESET, 'Software caused connection abort'), -(java.io.InterruptedIOException, ALL) : lambda: timeout('timed out'), +(java.io.IOException, ALL) : lambda x: error(errno.ECONNRESET, 'Software caused connection abort'), +(java.io.InterruptedIOException, ALL) : lambda x: timeout('timed out'), -(java.net.BindException, ALL) : lambda: error(errno.EADDRINUSE, 'Address already in use'), -(java.net.ConnectException, ALL) : lambda: error(errno.ECONNREFUSED, 'Connection refused'), +(java.net.BindException, ALL) : lambda x: error(errno.EADDRINUSE, 'Address already in use'), +(java.net.ConnectException, ALL) : lambda x: error(errno.ECONNREFUSED, 'Connection refused'), (java.net.NoRouteToHostException, ALL) : None, (java.net.PortUnreachableException, ALL) : None, (java.net.ProtocolException, ALL) : None, -(java.net.SocketException, ALL) : None, -(java.net.SocketTimeoutException, ALL) : lambda: timeout('timed out'), -(java.net.UnknownHostException, ALL) : lambda: gaierror(errno.EGETADDRINFOFAILED, 'getaddrinfo failed'), +(java.net.SocketException, ALL) : java_net_socketexception_handler, +(java.net.SocketTimeoutException, ALL) : lambda x: timeout('timed out'), +(java.net.UnknownHostException, ALL) : lambda x: gaierror(errno.EGETADDRINFOFAILED, 'getaddrinfo failed'), -(java.nio.channels.AlreadyConnectedException, ALL) : lambda: error(errno.EISCONN, 'Socket is already connected'), +(java.nio.channels.AlreadyConnectedException, ALL) : lambda x: error(errno.EISCONN, 'Socket is already connected'), (java.nio.channels.AsynchronousCloseException, ALL) : None, (java.nio.channels.CancelledKeyException, ALL) : None, (java.nio.channels.ClosedByInterruptException, ALL) : None, -(java.nio.channels.ClosedChannelException, ALL) : lambda: error(errno.EPIPE, 'Socket closed'), +(java.nio.channels.ClosedChannelException, ALL) : lambda x: error(errno.EPIPE, 'Socket closed'), (java.nio.channels.ClosedSelectorException, ALL) : None, (java.nio.channels.ConnectionPendingException, ALL) : None, (java.nio.channels.IllegalBlockingModeException, ALL) : None, @@ -126,28 +137,25 @@ (java.nio.channels.NonWritableChannelException, ALL) : None, (java.nio.channels.NotYetBoundException, ALL) : None, (java.nio.channels.NotYetConnectedException, ALL) : None, -(java.nio.channels.UnresolvedAddressException, ALL) : lambda: gaierror(errno.EGETADDRINFOFAILED, 'getaddrinfo failed'), +(java.nio.channels.UnresolvedAddressException, ALL) : lambda x: gaierror(errno.EGETADDRINFOFAILED, 'getaddrinfo failed'), (java.nio.channels.UnsupportedAddressTypeException, ALL) : None, # These error codes are currently wrong: getting them correct is going to require # some investigation. Cpython 2.6 introduced extensive SSL support. -(javax.net.ssl.SSLException, ALL) : lambda: sslerror(-1, 'SSL exception'), -(javax.net.ssl.SSLHandshakeException, ALL) : lambda: sslerror(-1, 'SSL handshake exception'), -(javax.net.ssl.SSLKeyException, ALL) : lambda: sslerror(-1, 'SSL key exception'), -(javax.net.ssl.SSLPeerUnverifiedException, ALL) : lambda: sslerror(-1, 'SSL peer unverified exception'), -(javax.net.ssl.SSLProtocolException, ALL) : lambda: sslerror(-1, 'SSL protocol exception'), +(javax.net.ssl.SSLException, ALL) : lambda x: sslerror(-1, 'SSL exception'), +(javax.net.ssl.SSLHandshakeException, ALL) : lambda x: sslerror(-1, 'SSL handshake exception'), +(javax.net.ssl.SSLKeyException, ALL) : lambda x: sslerror(-1, 'SSL key exception'), +(javax.net.ssl.SSLPeerUnverifiedException, ALL) : lambda x: sslerror(-1, 'SSL peer unverified exception'), +(javax.net.ssl.SSLProtocolException, ALL) : lambda x: sslerror(-1, 'SSL protocol exception'), } -def would_block_error(exc=None): - return error(errno.EWOULDBLOCK, 'The socket operation could not complete without blocking') - def _map_exception(exc, circumstance=ALL): # print "Mapping exception: %s" % exc mapped_exception = _exception_map.get((exc.__class__, circumstance)) if mapped_exception: - exception = mapped_exception() + exception = mapped_exception(exc) else: exception = error(-1, 'Unmapped exception: %s' % exc) exception.java_exception = exc @@ -588,7 +596,7 @@ return Protocol.getProtocolByName(protocol_name).getProto() def _realsocket(family = AF_INET, type = SOCK_STREAM, protocol=0): - assert family == AF_INET, "Only AF_INET sockets are currently supported on jython" + assert family in (AF_INET, AF_INET6), "Only AF_INET and AF_INET6 sockets are currently supported on jython" assert type in (SOCK_DGRAM, SOCK_STREAM), "Only SOCK_STREAM and SOCK_DGRAM sockets are currently supported on jython" if type == SOCK_STREAM: if protocol != 0: @@ -599,16 +607,25 @@ assert protocol == IPPROTO_UDP, "Only IPPROTO_UDP supported on SOCK_DGRAM sockets" return _udpsocket() +_ipv4_addresses_only = False + +def _use_ipv4_addresses_only(value): + global _ipv4_addresses_only + _ipv4_addresses_only = value + def getaddrinfo(host, port, family=AF_INET, socktype=None, proto=0, flags=None): try: if not family in [AF_INET, AF_INET6, AF_UNSPEC]: raise gaierror(errno.EIO, 'ai_family not supported') filter_fns = [] - filter_fns.append({ - AF_INET: lambda x: isinstance(x, java.net.Inet4Address), - AF_INET6: lambda x: isinstance(x, java.net.Inet6Address), - AF_UNSPEC: lambda x: isinstance(x, java.net.InetAddress), - }[family]) + if _ipv4_addresses_only: + filter_fns.append( lambda x: isinstance(x, java.net.Inet4Address) ) + else: + filter_fns.append({ + AF_INET: lambda x: isinstance(x, java.net.Inet4Address), + AF_INET6: lambda x: isinstance(x, java.net.Inet6Address), + AF_UNSPEC: lambda x: isinstance(x, java.net.InetAddress), + }[family]) if host == "": host = java.net.InetAddress.getLocalHost().getHostName() passive_mode = flags is not None and flags & AI_PASSIVE @@ -617,18 +634,16 @@ for a in java.net.InetAddress.getAllByName(host): if len([f for f in filter_fns if f(a)]): family = {java.net.Inet4Address: AF_INET, java.net.Inet6Address: AF_INET6}[a.getClass()] - # bug 1697: exclude IPv6 addresses from being returned - if family != AF_INET6: - if passive_mode and not canonname_mode: - canonname = "" - else: - canonname = asPyString(a.getCanonicalHostName()) - if host is None and passive_mode and not canonname_mode: - sockname = INADDR_ANY - else: - sockname = asPyString(a.getHostAddress()) - # TODO: Include flowinfo and scopeid in a 4-tuple for IPv6 addresses - results.append((family, socktype, proto, canonname, (sockname, port))) + if passive_mode and not canonname_mode: + canonname = "" + else: + canonname = asPyString(a.getCanonicalHostName()) + if host is None and passive_mode and not canonname_mode: + sockname = INADDR_ANY + else: + sockname = asPyString(a.getHostAddress()) + # TODO: Include flowinfo and scopeid in a 4-tuple for IPv6 addresses + results.append((family, socktype, proto, canonname, (sockname, port))) return results except java.lang.Exception, jlx: raise _map_exception(jlx) Modified: trunk/jython/Lib/test/test_socket.py =================================================================== --- trunk/jython/Lib/test/test_socket.py 2011-01-23 15:58:55 UTC (rev 7190) +++ trunk/jython/Lib/test/test_socket.py 2011-01-25 23:46:27 UTC (rev 7191) @@ -1493,6 +1493,15 @@ self.failUnlessEqual(expected_canonname, canonname, "For hostname '%s' and flags %d, canonname '%s' != '%s'" % (host_param, flags, expected_canonname, canonname) ) self.failUnlessEqual(expected_sockaddr, sockaddr[0], "For hostname '%s' and flags %d, sockaddr '%s' != '%s'" % (host_param, flags, expected_sockaddr, sockaddr[0]) ) + def testIPV4AddressesOnly(self): + socket._use_ipv4_addresses_only(True) + def doAddressTest(addrinfos): + for family, socktype, proto, canonname, sockaddr in addrinfos: + self.failIf(":" in sockaddr[0], "Incorrectly received IPv6 address '%s'" % (sockaddr[0]) ) + doAddressTest(socket.getaddrinfo("localhost", 0, socket.AF_INET6, socket.SOCK_STREAM, 0, 0)) + doAddressTest(socket.getaddrinfo("localhost", 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, 0)) + socket._use_ipv4_addresses_only(False) + class TestExceptions(unittest.TestCase): def testExceptionTree(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-01-23 15:59:01
|
Revision: 7190 http://jython.svn.sourceforge.net/jython/?rev=7190&view=rev Author: otmarhumbel Date: 2011-01-23 15:58:55 +0000 (Sun, 23 Jan 2011) Log Message: ----------- fix bug #1697 by excluding IPv6 addresses from socket.getaddrinfo(); this is a temporary fix, since we should support IPv6 in the future Modified Paths: -------------- trunk/jython/NEWS Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-01-23 15:51:34 UTC (rev 7189) +++ trunk/jython/NEWS 2011-01-23 15:58:55 UTC (rev 7190) @@ -4,6 +4,7 @@ Bugs Fixed - [ 1667 ] thread.local subclasses with constructor params fail - [ 1698 ] warnings module fails under JSR-223 + - [ 1697 ] Wrong error message when http connection can not be established Jython 2.5.2rc3 Bugs Fixed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-01-23 15:51:40
|
Revision: 7189 http://jython.svn.sourceforge.net/jython/?rev=7189&view=rev Author: otmarhumbel Date: 2011-01-23 15:51:34 +0000 (Sun, 23 Jan 2011) Log Message: ----------- fix bug #1697 by excluding IPv6 addresses from socket.getaddrinfo(); this is a temporary fix, since we should support IPv6 in the future Modified Paths: -------------- trunk/jython/Lib/socket.py Added Paths: ----------- trunk/jython/Lib/test/test_socket_jy.py Modified: trunk/jython/Lib/socket.py =================================================================== --- trunk/jython/Lib/socket.py 2011-01-22 21:24:58 UTC (rev 7188) +++ trunk/jython/Lib/socket.py 2011-01-23 15:51:34 UTC (rev 7189) @@ -617,16 +617,18 @@ for a in java.net.InetAddress.getAllByName(host): if len([f for f in filter_fns if f(a)]): family = {java.net.Inet4Address: AF_INET, java.net.Inet6Address: AF_INET6}[a.getClass()] - if passive_mode and not canonname_mode: - canonname = "" - else: - canonname = asPyString(a.getCanonicalHostName()) - if host is None and passive_mode and not canonname_mode: - sockname = INADDR_ANY - else: - sockname = asPyString(a.getHostAddress()) - # TODO: Include flowinfo and scopeid in a 4-tuple for IPv6 addresses - results.append((family, socktype, proto, canonname, (sockname, port))) + # bug 1697: exclude IPv6 addresses from being returned + if family != AF_INET6: + if passive_mode and not canonname_mode: + canonname = "" + else: + canonname = asPyString(a.getCanonicalHostName()) + if host is None and passive_mode and not canonname_mode: + sockname = INADDR_ANY + else: + sockname = asPyString(a.getHostAddress()) + # TODO: Include flowinfo and scopeid in a 4-tuple for IPv6 addresses + results.append((family, socktype, proto, canonname, (sockname, port))) return results except java.lang.Exception, jlx: raise _map_exception(jlx) Added: trunk/jython/Lib/test/test_socket_jy.py =================================================================== --- trunk/jython/Lib/test/test_socket_jy.py (rev 0) +++ trunk/jython/Lib/test/test_socket_jy.py 2011-01-23 15:51:34 UTC (rev 7189) @@ -0,0 +1,25 @@ +import httplib +import socket +import sys +from test import test_support +import unittest + + +class SocketIPv6Test(unittest.TestCase): + + def test_connect_localhost(self): + '''Ensures a correct socket.error message''' + conn = httplib.HTTPConnection('localhost', 18080) + body = "" + headers = {} + try: + conn.request("GET", "/RELEASE-NOTES.txt", body, headers) + except socket.error: + pass # used to get an AssertionError (see bug 1697) + + +def test_main(): + test_support.run_unittest(SocketIPv6Test) + +if __name__ == "__main__": + test_main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-01-22 21:25:04
|
Revision: 7188 http://jython.svn.sourceforge.net/jython/?rev=7188&view=rev Author: pjenvey Date: 2011-01-22 21:24:58 +0000 (Sat, 22 Jan 2011) Log Message: ----------- add more missing dict-like methods to the jsr223 scope. fixes the warning module under jsr223 fixes #1698 Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-01-21 01:23:32 UTC (rev 7187) +++ trunk/jython/NEWS 2011-01-22 21:24:58 UTC (rev 7188) @@ -3,6 +3,7 @@ Jython 2.5.2 Bugs Fixed - [ 1667 ] thread.local subclasses with constructor params fail + - [ 1698 ] warnings module fails under JSR-223 Jython 2.5.2rc3 Bugs Fixed Modified: trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java =================================================================== --- trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java 2011-01-21 01:23:32 UTC (rev 7187) +++ trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java 2011-01-22 21:24:58 UTC (rev 7188) @@ -75,7 +75,47 @@ return new ScopeIterator(this); } + @ExposedMethod(defaults = "Py.None") + final PyObject scope_get(PyObject keyObj, PyObject defaultObj) { + String key = keyObj.asString(); + int scope = context.getAttributesScope(key); + return scope == -1 ? defaultObj : Py.java2py(context.getAttribute(key, scope)); + } + + @ExposedMethod + final boolean scope_has_key(PyObject key) { + return context.getAttributesScope(key.asString()) != -1; + } + @Override + public boolean __contains__(PyObject obj) { + return scope___contains__(obj); + } + + @ExposedMethod + final boolean scope___contains__(PyObject obj) { + return scope_has_key(obj); + } + + @ExposedMethod(defaults = "Py.None") + final PyObject scope_setdefault(PyObject keyObj, PyObject failObj) { + PyObject result; + String key = keyObj.asString(); + int scope = context.getAttributesScope(key); + if (scope == -1) { + scope = ScriptContext.ENGINE_SCOPE; + context.setAttribute(key, + failObj instanceof PyType + ? failObj : failObj.__tojava__(Object.class), + scope); + result = failObj; + } else { + result = Py.java2py(context.getAttribute(key, scope)); + } + return result; + } + + @Override public String toString() { return getDictionary().toString(); } Modified: trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java =================================================================== --- trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2011-01-21 01:23:32 UTC (rev 7187) +++ trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2011-01-22 21:24:58 UTC (rev 7188) @@ -263,5 +263,13 @@ assertEquals("a string", pythonEngine.get("result")); assertEquals("a string", pythonEngine.get("result2")); } + + public void testIssue1698() throws ScriptException{ + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine pythonEngine = manager.getEngineByName("python"); + pythonEngine.eval("import warnings"); + // Would previously fail + pythonEngine.eval("warnings.warn('test')"); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-01-21 01:23:38
|
Revision: 7187 http://jython.svn.sourceforge.net/jython/?rev=7187&view=rev Author: pjenvey Date: 2011-01-21 01:23:32 +0000 (Fri, 21 Jan 2011) Log Message: ----------- docs typo Modified Paths: -------------- trunk/jython/src/org/python/modules/thread/PyLocal.java Modified: trunk/jython/src/org/python/modules/thread/PyLocal.java =================================================================== --- trunk/jython/src/org/python/modules/thread/PyLocal.java 2011-01-21 01:18:35 UTC (rev 7186) +++ trunk/jython/src/org/python/modules/thread/PyLocal.java 2011-01-21 01:23:32 UTC (rev 7187) @@ -28,8 +28,8 @@ public PyLocal(PyType subType) { super(subType); - // Don't lazy load the underlying dict in the insantiating thread; that would call - // __init__ a the second time + // Don't lazy load the underlying dict in the instantiating thread; that would + // call __init__ a the second time tdict.set(new PyDictionary()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-01-21 01:18:41
|
Revision: 7186 http://jython.svn.sourceforge.net/jython/?rev=7186&view=rev Author: pjenvey Date: 2011-01-21 01:18:35 +0000 (Fri, 21 Jan 2011) Log Message: ----------- o fix threading.local subclassing problems with __init__ arguments o fastGetDict doesn't need to synchronize around a ThreadLocal initialization fixes #1667 thanks Kelly Campbell Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/modules/thread/PyLocal.java Added Paths: ----------- trunk/jython/Lib/test/test_threading_local_jy.py Added: trunk/jython/Lib/test/test_threading_local_jy.py =================================================================== --- trunk/jython/Lib/test/test_threading_local_jy.py (rev 0) +++ trunk/jython/Lib/test/test_threading_local_jy.py 2011-01-21 01:18:35 UTC (rev 7186) @@ -0,0 +1,61 @@ +"""Test for thread locals""" +import random +import sys +import threading +import time +import unittest +from test import test_support +from threading import local + +class LocalStuff(local): + def __init__(self, stuff, foo=1): + local.__init__(self) + self.stuff = stuff + self.foo = foo + +class TestThread(threading.Thread): + def __init__(self, stuff, name): + threading.Thread.__init__(self) + self.stuff = stuff + self.name = name + self.errors = [] + + def run(self): + for i in xrange(10): + try: + self.stuff.stuff = self.name + myStuff = self.stuff.stuff + time.sleep(random.random() * 2) + if myStuff != self.stuff.stuff: + self.errors.append("myStuff should equal self.stuff.stuff") + if self.stuff.foo != 1: + self.errors.append("foo should be 1") + except TypeError, te: + self.errors.append("TypeError: %s" % te) + except: + self.errors.append("unexpected error: %s" % sys.exc_info()[0] ) + + def getErrors(self): + return self.errors + +class ThreadLocalConstructorTestCase(unittest.TestCase): + + def test_construct_locals(self): + """Ensures that constructing a local can have arguments""" + stuff = LocalStuff("main stuff") + threads = [] + for i in xrange(20): + threads.append(TestThread(stuff, name=("thread-%d" % i))) + threads[i].start() + for i in xrange(20): + threads[i].join() + errors = threads[i].getErrors() + self.assertEquals(0, len(errors), errors) + + +def test_main(): + test_support.run_unittest(ThreadLocalConstructorTestCase) + + +if __name__ == "__main__": + test_main() Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-01-10 23:29:19 UTC (rev 7185) +++ trunk/jython/NEWS 2011-01-21 01:18:35 UTC (rev 7186) @@ -1,5 +1,9 @@ Jython NEWS +Jython 2.5.2 + Bugs Fixed + - [ 1667 ] thread.local subclasses with constructor params fail + Jython 2.5.2rc3 Bugs Fixed - [ 1674 ] PDB crashes under the JSR-223 scripting engine Modified: trunk/jython/src/org/python/modules/thread/PyLocal.java =================================================================== --- trunk/jython/src/org/python/modules/thread/PyLocal.java 2011-01-10 23:29:19 UTC (rev 7185) +++ trunk/jython/src/org/python/modules/thread/PyLocal.java 2011-01-21 01:18:35 UTC (rev 7186) @@ -1,3 +1,4 @@ +/* Copyright (c) Jython Developers */ package org.python.modules.thread; import org.python.core.Py; @@ -6,7 +7,6 @@ import org.python.core.PyObject; import org.python.core.PyType; import org.python.expose.ExposedGet; -import org.python.expose.ExposedMethod; import org.python.expose.ExposedNew; import org.python.expose.ExposedSet; import org.python.expose.ExposedType; @@ -28,9 +28,8 @@ public PyLocal(PyType subType) { super(subType); - // Because the instantiation of a type instance in PyType.invoke_new_ - // calls dispatch__init__, we call tdict.set here so dispatch__init__ - // doesn't get called a second time for a thread in fastGetDict + // Don't lazy load the underlying dict in the insantiating thread; that would call + // __init__ a the second time tdict.set(new PyDictionary()); } @@ -40,29 +39,24 @@ PyType subtype, PyObject[] args, String[] keywords) { + PyObject[] where = new PyObject[1]; + subtype.lookup_where("__init__", where); + if (where[0] == PyObject.TYPE && args.length > 0) { + throw Py.TypeError("Initialization arguments are not supported"); + } + PyLocal newobj; if (new_.getWrappedType() == subtype) { newobj = new PyLocal(); } else { newobj = new PyLocalDerived(subtype); } - if (init) { - newobj._local___init__(args, keywords); - } + newobj.args = args; + newobj.keywords = keywords; + return newobj; } - @ExposedMethod - final void _local___init__(PyObject[] args, String[] keywords) { - PyObject[] where = new PyObject[1]; - getType().lookup_where("__init__", where); - if (where[0] == TYPE && args.length > 0) { - throw Py.TypeError("Initialization arguments are not supported"); - } - this.args = args; - this.keywords = keywords; - } - @Override @ExposedGet(name = "__dict__") public PyObject getDict() { @@ -76,7 +70,7 @@ } @Override - public synchronized PyObject fastGetDict() { + public PyObject fastGetDict() { PyDictionary ldict = tdict.get(); if (ldict == null) { ldict = new PyDictionary(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-01-10 23:29:29
|
Revision: 7185 http://jython.svn.sourceforge.net/jython/?rev=7185&view=rev Author: otmarhumbel Date: 2011-01-10 23:29:19 +0000 (Mon, 10 Jan 2011) Log Message: ----------- website preparation for 2.5.2rc3 Modified Paths: -------------- trunk/website/index.txt trunk/website/jysite.py trunk/website/redirects/downloads.txt trunk/website/redirects/latest.txt Modified: trunk/website/index.txt =================================================================== --- trunk/website/index.txt 2011-01-10 21:48:12 UTC (rev 7184) +++ trunk/website/index.txt 2011-01-10 23:29:19 UTC (rev 7185) @@ -4,6 +4,10 @@ Latest News ~~~~~~~~~~~ +**Jython 2.5.2 RC 3 Has Been Released** (January 11, 2011) + +The Jython development team would like to announce the release of 2.5.2 Release Candidate 3. For a complete listing of changes, please visit the `Release Notes`_. + **Jython 2.5.2 RC 2 Has Been Released** (October 24, 2010) The Jython development team would like to announce the release of 2.5.2 Release Candidate 2. For a complete listing of changes, please visit the `Release Notes`_. @@ -93,7 +97,7 @@ .. _this post: http://blog.springpython.webfactional.com/2009/10/15/see-how-spring-python-works-with-jython/ .. _Release Notes: http://www.jython.org/latest.html .. _the bug tracker: http://bugs.jython.org -.. _download the installer by clicking here: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc2/jython_installer-2.5.2rc2.jar/download +.. _download the installer by clicking here: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc3/jython_installer-2.5.2rc3.jar/download Modified: trunk/website/jysite.py =================================================================== --- trunk/website/jysite.py 2011-01-10 21:48:12 UTC (rev 7184) +++ trunk/website/jysite.py 2011-01-10 23:29:19 UTC (rev 7185) @@ -80,9 +80,9 @@ buffer.append('<a href="./" ><img class="logoImage" alt="Jython" style="border: 0px; padding-top: 20px; position:absolute; left: 35px" src="css/jython.png" title="Jython"></a>') buffer.append('</div>') buffer.append('<div class="latest_release" style="position:absolute; color:#000; width:180px; top: 15px; right: 30px; padding:0px 10px 10px 30px; font-size:11px; background:url(\'css/latest_release_bg.png\') no-repeat">') - buffer.append('<p style="top: 25px; color:#000">Latest release - 2.5.2 - RC 2<br/>') + buffer.append('<p style="top: 25px; color:#000">Latest release - 2.5.2 - RC 3<br/>') buffer.append('<a style="color:#000" href="latest.html">View Release Notes</a><br/>') - buffer.append('Download: <a style="color:#000" href="http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc2/jython_installer-2.5.2rc2.jar/download">.jar</a>') + buffer.append('Download: <a style="color:#000" href="http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc3/jython_installer-2.5.2rc3.jar/download">.jar</a>') buffer.append('</div>') buffer.append('<div class="searchbox">') Modified: trunk/website/redirects/downloads.txt =================================================================== --- trunk/website/redirects/downloads.txt 2011-01-10 21:48:12 UTC (rev 7184) +++ trunk/website/redirects/downloads.txt 2011-01-10 23:29:19 UTC (rev 7185) @@ -1,14 +1,14 @@ Downloads --------- -The current version of Jython is 2.5.2 - Release Candidate 2, please use the link below to download the Java installer. +The current version of Jython is 2.5.2 - Release Candidate 3, please use the link below to download the Java installer. Once downloaded, please double-click on the JAR file to start the installation process. You may also want to read the `Installation instructions`_ or the `Release Notes`_. -`Download Jython 2.5.2`_ RC 2 +`Download Jython 2.5.2`_ RC 3 -- MD5: ``3f03c9c5a7541d6c47b9beb17777860b`` -- SHA1: ``bc38e7910ff221e260401b84b995a1ad970680b3`` +- MD5: ``4ffedc964ce01b0be9cb4793550311be`` +- SHA1: ``547c424a119661ed1901079ff8f4e45af7d57b56`` Previous Releases ----------------- @@ -28,7 +28,7 @@ - MD5: ``774543534bef2d68247953882237d448`` - SHA1: ``6fea1e8985af955fc843789e2d60fcfc38a76fd8`` -.. _Download Jython 2.5.2: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc2/jython_installer-2.5.2rc2.jar/download +.. _Download Jython 2.5.2: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc3/jython_installer-2.5.2rc3.jar/download .. _Jython 2.5.1: http://sourceforge.net/projects/jython/files/jython/2.5.1/jython_installer-2.5.1.jar/download .. _Jython 2.5.0: http://sourceforge.net/projects/jython/files/jython/2.5.0/jython_installer-2.5.0.jar/download .. _Jython 2.2.1: http://sourceforge.net/projects/jython/files/jython/jython_installer-2.2.1.jar Modified: trunk/website/redirects/latest.txt =================================================================== --- trunk/website/redirects/latest.txt 2011-01-10 21:48:12 UTC (rev 7184) +++ trunk/website/redirects/latest.txt 2011-01-10 23:29:19 UTC (rev 7185) @@ -6,6 +6,16 @@ Bugs Fixed ---------- +2.5.2-rc3 +~~~~~~~~~ + - [ 1674 ] PDB crashes under the JSR-223 scripting engine + - [ 1680 ] jython -c option is not parsed right + - [ 1681 ] JSR-223, Jython 2.5.2 and implementing Java Interfaces from Python + - [ 1675 ] Jython exits prematurely when executing a file, thus killing Swing windows + - [ 1682 ] exit code of 0 on unhandled exception + - [ 1668 ] strptime('','') works on cpython but not on jython + - [ 1693 ] Unicode sys.path elements cause UnicodeErrors on import + 2.5.2-rc2 ~~~~~~~~~ - [ 1665 ] cPickle calls __import__ with illegal parameters This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-01-10 21:48:18
|
Revision: 7184 http://jython.svn.sourceforge.net/jython/?rev=7184&view=rev Author: otmarhumbel Date: 2011-01-10 21:48:12 +0000 (Mon, 10 Jan 2011) Log Message: ----------- tagging 2.5.2rc3 Added Paths: ----------- tags/Release_2_5_2rc3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-01-10 21:42:52
|
Revision: 7183 http://jython.svn.sourceforge.net/jython/?rev=7183&view=rev Author: otmarhumbel Date: 2011-01-10 21:42:46 +0000 (Mon, 10 Jan 2011) Log Message: ----------- prepare for 2.5.2rc3 Modified Paths: -------------- trunk/jython/README.txt trunk/jython/build.xml Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2011-01-07 01:15:51 UTC (rev 7182) +++ trunk/jython/README.txt 2011-01-10 21:42:46 UTC (rev 7183) @@ -1,10 +1,9 @@ -Welcome to Jython 2.5.2 rc2 +Welcome to Jython 2.5.2 rc3 =========================== -This is the second release candidate of the 2.5.2 version of Jython. -The major difference to rc1 is a fix for better IPython support. -We still hope that there won't be many more release candidates, but this -will depend on bug reports. +This is the third release candidate of the 2.5.2 version of Jython. +It contains the most important bug fixes since 2.5.2 rc2. +We believe that this is the last release candidate before the final 2.5.2 release! This release fixes bugs related to resource leaks, Java integration, and a number of other issues. See the NEWS file for more details. In Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2011-01-07 01:15:51 UTC (rev 7182) +++ trunk/jython/build.xml 2011-01-10 21:42:46 UTC (rev 7183) @@ -123,13 +123,13 @@ <property name="PY_RELEASE_LEVEL_SNAPSHOT" value="170"/> <!-- 0xAA --> <!-- The current version info --> - <property name="jython.version" value="2.5.2rc2"/> - <property name="jython.version.noplus" value="2.5.2rc2"/> + <property name="jython.version" value="2.5.2rc3"/> + <property name="jython.version.noplus" value="2.5.2rc3"/> <property name="jython.major_version" value="2"/> <property name="jython.minor_version" value="5"/> <property name="jython.micro_version" value="2"/> <property name="jython.release_level" value="${PY_RELEASE_LEVEL_GAMMA}"/> - <property name="jython.release_serial" value="2"/> + <property name="jython.release_serial" value="3"/> <condition property="do.snapshot.build"> <isset property="snapshot.revision" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-01-07 01:15:58
|
Revision: 7182 http://jython.svn.sourceforge.net/jython/?rev=7182&view=rev Author: pjenvey Date: 2011-01-07 01:15:51 +0000 (Fri, 07 Jan 2011) Log Message: ----------- special case handling of unicode sys.path items, basically pass them through fixes #1693 test case from Oti Modified Paths: -------------- trunk/jython/Lib/test/test_sys_jy.py trunk/jython/NEWS trunk/jython/src/org/python/core/SyspathJavaLoader.java trunk/jython/src/org/python/core/imp.java trunk/jython/src/org/python/core/packagecache/PathPackageManager.java Modified: trunk/jython/Lib/test/test_sys_jy.py =================================================================== --- trunk/jython/Lib/test/test_sys_jy.py 2010-12-29 01:59:20 UTC (rev 7181) +++ trunk/jython/Lib/test/test_sys_jy.py 2011-01-07 01:15:51 UTC (rev 7182) @@ -1,7 +1,10 @@ +from __future__ import with_statement +import os +import re import sys -import re +import tempfile import unittest -import test.test_support +from test import test_support class SysTest(unittest.TestCase): @@ -132,7 +135,7 @@ class SyspathResourceTest(unittest.TestCase): def setUp(self): self.orig_path = sys.path - sys.path.insert(0, test.test_support.findfile("bug1373.jar")) + sys.path.insert(0, test_support.findfile("bug1373.jar")) def tearDown(self): sys.path = self.orig_path @@ -146,8 +149,43 @@ self.assert_(Main.getResource('Main.txt')) +class SyspathUnicodeTest(unittest.TestCase): + """bug 1693: importing from a unicode path threw a unicode encoding + error""" + + def test_nonexisting_import_from_unicodepath(self): + # \xf6 = german o umlaut + sys.path.append(u'/home/tr\xf6\xf6t') + self.assertRaises(ImportError, __import__, 'non_existing_module') + + def test_import_from_unicodepath(self): + # \xf6 = german o umlaut + moduleDir = tempfile.mkdtemp(suffix=u'tr\xf6\xf6t') + try: + self.assertTrue(os.path.exists(moduleDir)) + module = 'unicodetempmodule' + moduleFile = '%s/%s.py' % (moduleDir, module) + try: + with open(moduleFile, 'w') as f: + f.write('# empty module') + self.assertTrue(os.path.exists(moduleFile)) + sys.path.append(moduleDir) + __import__(module) + moduleClassFile = '%s/%s$py.class' % (moduleDir, module) + self.assertTrue(os.path.exists(moduleClassFile)) + os.remove(moduleClassFile) + finally: + os.remove(moduleFile) + finally: + os.rmdir(moduleDir) + self.assertFalse(os.path.exists(moduleDir)) + + def test_main(): - test.test_support.run_unittest(SysTest, ShadowingTest, SyspathResourceTest) + test_support.run_unittest(SysTest, + ShadowingTest, + SyspathResourceTest, + SyspathUnicodeTest) if __name__ == "__main__": test_main() Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-12-29 01:59:20 UTC (rev 7181) +++ trunk/jython/NEWS 2011-01-07 01:15:51 UTC (rev 7182) @@ -8,6 +8,7 @@ - [ 1675 ] Jython exits prematurely when executing a file, thus killing Swing windows - [ 1682 ] exit code of 0 on unhandled exception - [ 1668 ] strptime('','') works on cpython but not on jython + - [ 1693 ] Unicode sys.path elements cause UnicodeErrors on import Jython 2.5.2rc2 Bugs Fixed Modified: trunk/jython/src/org/python/core/SyspathJavaLoader.java =================================================================== --- trunk/jython/src/org/python/core/SyspathJavaLoader.java 2010-12-29 01:59:20 UTC (rev 7181) +++ trunk/jython/src/org/python/core/SyspathJavaLoader.java 2011-01-07 01:15:51 UTC (rev 7182) @@ -3,7 +3,6 @@ package org.python.core; -import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -14,8 +13,6 @@ import java.util.StringTokenizer; import java.util.zip.ZipEntry; -import javax.management.RuntimeErrorException; - import org.python.core.util.RelativeFile; public class SyspathJavaLoader extends ClassLoader { @@ -115,7 +112,10 @@ SyspathArchive archive = (SyspathArchive)entry; buffer = getBytesFromArchive(archive, name); } else { - String dir = entry.__str__().toString(); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = entry.toString(); buffer = getBytesFromDir(dir, name); } if (buffer != null) { @@ -155,7 +155,10 @@ } continue; } - String dir = sys.getPath(entry.__str__().toString()); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = sys.getPath(entry.toString()); try { File resource = new File(dir, res); if (!resource.exists()) { Modified: trunk/jython/src/org/python/core/imp.java =================================================================== --- trunk/jython/src/org/python/core/imp.java 2010-12-29 01:59:20 UTC (rev 7181) +++ trunk/jython/src/org/python/core/imp.java 2011-01-07 01:15:51 UTC (rev 7182) @@ -436,7 +436,6 @@ } static PyObject find_module(String name, String moduleName, PyList path) { - PyObject loader = Py.None; PySystemState sys = Py.getSystemState(); PyObject metaPath = sys.meta_path; @@ -468,7 +467,10 @@ return loadFromLoader(loader, moduleName); } } - ret = loadFromSource(sys, name, moduleName, p.__str__().toString()); + if (!(p instanceof PyUnicode)) { + p = p.__str__(); + } + ret = loadFromSource(sys, name, moduleName, p.toString()); if (ret != null) { return ret; } Modified: trunk/jython/src/org/python/core/packagecache/PathPackageManager.java =================================================================== --- trunk/jython/src/org/python/core/packagecache/PathPackageManager.java 2010-12-29 01:59:20 UTC (rev 7181) +++ trunk/jython/src/org/python/core/packagecache/PathPackageManager.java 2011-01-07 01:15:51 UTC (rev 7182) @@ -7,7 +7,9 @@ import org.python.core.Py; import org.python.core.PyJavaPackage; import org.python.core.PyList; +import org.python.core.PyObject; import org.python.core.PyString; +import org.python.core.PyUnicode; import org.python.core.util.RelativeFile; import java.io.BufferedInputStream; @@ -38,7 +40,11 @@ + name; for (int i = 0; i < path.__len__(); i++) { - String dir = path.pyget(i).__str__().toString(); + PyObject entry = path.pyget(i); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = entry.toString(); File f = new RelativeFile(dir, child); try { @@ -96,7 +102,12 @@ String child = jpkg.__name__.replace('.', File.separatorChar); for (int i = 0; i < path.__len__(); i++) { - String dir = path.pyget(i).__str__().toString(); + PyObject entry = path.pyget(i); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = entry.toString(); + if (dir.length() == 0) { dir = null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-29 01:59:27
|
Revision: 7181 http://jython.svn.sourceforge.net/jython/?rev=7181&view=rev Author: pjenvey Date: 2010-12-29 01:59:20 +0000 (Wed, 29 Dec 2010) Log Message: ----------- fix strptime('','') fixes #1668 patch from Israel Tsadok Modified Paths: -------------- trunk/jython/Lib/test/test_time.py trunk/jython/NEWS trunk/jython/src/org/python/modules/time/Time.java Modified: trunk/jython/Lib/test/test_time.py =================================================================== --- trunk/jython/Lib/test/test_time.py 2010-12-27 15:50:19 UTC (rev 7180) +++ trunk/jython/Lib/test/test_time.py 2010-12-29 01:59:20 UTC (rev 7181) @@ -120,6 +120,12 @@ except ValueError: self.fail('conversion specifier: %r failed.' % format) + def test_strptime_empty(self): + try: + time.strptime('', '') + except ValueError: + self.fail('strptime failed on empty args.') + def test_asctime(self): time.asctime(time.gmtime(self.t)) self.assertRaises(TypeError, time.asctime, 0) Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-12-27 15:50:19 UTC (rev 7180) +++ trunk/jython/NEWS 2010-12-29 01:59:20 UTC (rev 7181) @@ -7,6 +7,7 @@ - [ 1681 ] JSR-223, Jython 2.5.2 and implementing Java Interfaces from Python - [ 1675 ] Jython exits prematurely when executing a file, thus killing Swing windows - [ 1682 ] exit code of 0 on unhandled exception + - [ 1668 ] strptime('','') works on cpython but not on jython Jython 2.5.2rc2 Bugs Fixed Modified: trunk/jython/src/org/python/modules/time/Time.java =================================================================== --- trunk/jython/src/org/python/modules/time/Time.java 2010-12-27 15:50:19 UTC (rev 7180) +++ trunk/jython/src/org/python/modules/time/Time.java 2010-12-29 01:59:20 UTC (rev 7181) @@ -759,6 +759,10 @@ boolean directive = false; boolean inQuote = false; + if (format.length() == 0) { + return null; + } + for (int i = 0; i < format.length(); i++) { char charAt = format.charAt(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2010-12-27 15:50:25
|
Revision: 7180 http://jython.svn.sourceforge.net/jython/?rev=7180&view=rev Author: otmarhumbel Date: 2010-12-27 15:50:19 +0000 (Mon, 27 Dec 2010) Log Message: ----------- add a package declaration to the PythonCallable test interface Modified Paths: -------------- trunk/jython/tests/java/org/python/jsr223/PythonCallable.java trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java Modified: trunk/jython/tests/java/org/python/jsr223/PythonCallable.java =================================================================== --- trunk/jython/tests/java/org/python/jsr223/PythonCallable.java 2010-12-24 23:27:23 UTC (rev 7179) +++ trunk/jython/tests/java/org/python/jsr223/PythonCallable.java 2010-12-27 15:50:19 UTC (rev 7180) @@ -1,3 +1,5 @@ +package org.python.jsr223; + public interface PythonCallable { String getAString(); void callAVoid(); Modified: trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java =================================================================== --- trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2010-12-24 23:27:23 UTC (rev 7179) +++ trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2010-12-27 15:50:19 UTC (rev 7180) @@ -2,8 +2,7 @@ import java.io.IOException; import java.io.StringReader; -import java.util.logging.Level; -import java.util.logging.Logger; + import javax.script.Bindings; import javax.script.Compilable; import javax.script.CompiledScript; @@ -13,7 +12,9 @@ import javax.script.ScriptEngineManager; import javax.script.ScriptException; import javax.script.SimpleScriptContext; + import junit.framework.TestCase; + import org.python.core.PyString; public class ScriptEngineTest extends TestCase { @@ -253,7 +254,7 @@ public void testIssue1681() throws ScriptException{ ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine pythonEngine = manager.getEngineByName("python"); - pythonEngine.eval("import PythonCallable\n" + + pythonEngine.eval("from org.python.jsr223 import PythonCallable\n" + "class MyPythonCallable(PythonCallable):\n" + " def getAString(self): return 'a string'\n\n" + "result = MyPythonCallable().getAString()\n" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-24 23:27:30
|
Revision: 7179 http://jython.svn.sourceforge.net/jython/?rev=7179&view=rev Author: pjenvey Date: 2010-12-24 23:27:23 +0000 (Fri, 24 Dec 2010) Log Message: ----------- dos2unix Modified Paths: -------------- trunk/jython/Lib/readline.py Modified: trunk/jython/Lib/readline.py =================================================================== --- trunk/jython/Lib/readline.py 2010-12-24 23:23:05 UTC (rev 7178) +++ trunk/jython/Lib/readline.py 2010-12-24 23:27:23 UTC (rev 7179) @@ -1,181 +1,181 @@ -from __future__ import with_statement -import os.path -import sys -from warnings import warn - -import java.lang.reflect.Array - -__all__ = ['add_history', 'clear_history', 'get_begidx', 'get_completer', - 'get_completer_delims', 'get_current_history_length', - 'get_endidx', 'get_history_item', 'get_history_length', - 'get_line_buffer', 'insert_text', 'parse_and_bind', - 'read_history_file', 'read_init_file', 'redisplay', - 'remove_history_item', 'set_completer', 'set_completer_delims', - 'set_history_length', 'set_pre_input_hook', 'set_startup_hook', - 'write_history_file'] - -try: - _reader = sys._jy_interpreter.reader -except AttributeError: - raise ImportError("Cannot access JLineConsole") - -_history_list = None - -# The need for the following warnings should go away once we update -# JLine. Choosing ImportWarning as the closest warning to what is -# going on here, namely this is functionality not yet available on -# Jython. - -class NotImplementedWarning(ImportWarning): - """Not yet implemented by Jython""" - -class SecurityWarning(ImportWarning): - """Security manager prevents access to private field""" - - -def _setup_history(): - # This is obviously not desirable, but avoids O(n) workarounds to - # modify the history (ipython uses the function - # remove_history_item to mutate the history relatively frequently) - global _history_list - - history = _reader.history - try: - history_list_field = history.class.getDeclaredField("history") - history_list_field.setAccessible(True) - _history_list = history_list_field.get(history) - except: - pass - -_setup_history() - -def parse_and_bind(string): - if string == "tab: complete": - try: - keybindings_field = _reader.class.getDeclaredField("keybindings") - keybindings_field.setAccessible(True) - keybindings = keybindings_field.get(_reader) - COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') - if java.lang.reflect.Array.getShort(keybindings, 9) != COMPLETE: - java.lang.reflect.Array.setShort(keybindings, 9, COMPLETE) - except: - warn("Cannot bind tab key to complete. You need to do this in a .jlinebindings.properties file instead", SecurityWarning, stacklevel=2) - else: - warn("Cannot bind key %s. You need to do this in a .jlinebindings.properties file instead" % (string,), NotImplementedWarning, stacklevel=2) - -def get_line_buffer(): - return str(_reader.cursorBuffer.buffer) - -def insert_text(string): - _reader.putString(string) - -def read_init_file(filename=None): - warn("read_init_file: %s" % (filename,), NotImplementedWarning, "module", 2) - -def read_history_file(filename="~/.history"): - print "Reading history:", filename - expanded = os.path.expanduser(filename) - new_history = _reader.getHistory().getClass()() - # new_history.clear() - with open(expanded) as f: - for line in f: - new_history.addToHistory(line.rstrip()) - _reader.history = new_history - _setup_history() - -def write_history_file(filename="~/.history"): - expanded = os.path.expanduser(filename) - with open(expanded, 'w') as f: - for line in _reader.history.historyList: - f.write(line) - f.write("\n") - -def clear_history(): - _reader.history.clear() - -def add_history(line): - _reader.addToHistory(line) - -def get_history_length(): - return _reader.history.maxSize - -def set_history_length(length): - _reader.history.maxSize = length - -def get_current_history_length(): - return len(_reader.history.historyList) - -def get_history_item(index): - return _reader.history.historyList[index] - -def remove_history_item(pos): - if _history_list: - _history_list.remove(pos) - else: - warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning, stacklevel=2) - -def redisplay(): - _reader.redrawLine() - -def set_startup_hook(function=None): - sys._jy_interpreter.startupHook = function - -def set_pre_input_hook(function=None): - warn("set_pre_input_hook %s" % (function,), NotImplementedWarning, stacklevel=2) - -_completer_function = None - -def set_completer(function=None): - """set_completer([function]) -> None - Set or remove the completer function. - The function is called as function(text, state), - for state in 0, 1, 2, ..., until it returns a non-string. - It should return the next possible completion starting with 'text'.""" - - global _completer_function - _completer_function = function - - def complete_handler(buffer, cursor, candidates): - start = _get_delimited(buffer, cursor)[0] - delimited = buffer[start:cursor] - for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? - completion = None - try: - completion = function(delimited, state) - except: - pass - if completion: - candidates.add(completion) - else: - break - return start - - _reader.addCompletor(complete_handler) - - -def get_completer(): - return _completer_function - -def _get_delimited(buffer, cursor): - start = cursor - for i in xrange(cursor-1, -1, -1): - if buffer[i] in _completer_delims: - break - start = i - return start, cursor - -def get_begidx(): - return _get_delimited(str(_reader.cursorBuffer.buffer), _reader.cursorBuffer.cursor)[0] - -def get_endidx(): - return _get_delimited(str(_reader.cursorBuffer.buffer), _reader.cursorBuffer.cursor)[1] - -def set_completer_delims(string): - global _completer_delims, _completer_delims_set - _completer_delims = string - _completer_delims_set = set(string) - -def get_completer_delims(): - return _completer_delims - -set_completer_delims(' \t\n`~!@#$%^&*()-=+[{]}\\|;:\'",<>/?') +from __future__ import with_statement +import os.path +import sys +from warnings import warn + +import java.lang.reflect.Array + +__all__ = ['add_history', 'clear_history', 'get_begidx', 'get_completer', + 'get_completer_delims', 'get_current_history_length', + 'get_endidx', 'get_history_item', 'get_history_length', + 'get_line_buffer', 'insert_text', 'parse_and_bind', + 'read_history_file', 'read_init_file', 'redisplay', + 'remove_history_item', 'set_completer', 'set_completer_delims', + 'set_history_length', 'set_pre_input_hook', 'set_startup_hook', + 'write_history_file'] + +try: + _reader = sys._jy_interpreter.reader +except AttributeError: + raise ImportError("Cannot access JLineConsole") + +_history_list = None + +# The need for the following warnings should go away once we update +# JLine. Choosing ImportWarning as the closest warning to what is +# going on here, namely this is functionality not yet available on +# Jython. + +class NotImplementedWarning(ImportWarning): + """Not yet implemented by Jython""" + +class SecurityWarning(ImportWarning): + """Security manager prevents access to private field""" + + +def _setup_history(): + # This is obviously not desirable, but avoids O(n) workarounds to + # modify the history (ipython uses the function + # remove_history_item to mutate the history relatively frequently) + global _history_list + + history = _reader.history + try: + history_list_field = history.class.getDeclaredField("history") + history_list_field.setAccessible(True) + _history_list = history_list_field.get(history) + except: + pass + +_setup_history() + +def parse_and_bind(string): + if string == "tab: complete": + try: + keybindings_field = _reader.class.getDeclaredField("keybindings") + keybindings_field.setAccessible(True) + keybindings = keybindings_field.get(_reader) + COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') + if java.lang.reflect.Array.getShort(keybindings, 9) != COMPLETE: + java.lang.reflect.Array.setShort(keybindings, 9, COMPLETE) + except: + warn("Cannot bind tab key to complete. You need to do this in a .jlinebindings.properties file instead", SecurityWarning, stacklevel=2) + else: + warn("Cannot bind key %s. You need to do this in a .jlinebindings.properties file instead" % (string,), NotImplementedWarning, stacklevel=2) + +def get_line_buffer(): + return str(_reader.cursorBuffer.buffer) + +def insert_text(string): + _reader.putString(string) + +def read_init_file(filename=None): + warn("read_init_file: %s" % (filename,), NotImplementedWarning, "module", 2) + +def read_history_file(filename="~/.history"): + print "Reading history:", filename + expanded = os.path.expanduser(filename) + new_history = _reader.getHistory().getClass()() + # new_history.clear() + with open(expanded) as f: + for line in f: + new_history.addToHistory(line.rstrip()) + _reader.history = new_history + _setup_history() + +def write_history_file(filename="~/.history"): + expanded = os.path.expanduser(filename) + with open(expanded, 'w') as f: + for line in _reader.history.historyList: + f.write(line) + f.write("\n") + +def clear_history(): + _reader.history.clear() + +def add_history(line): + _reader.addToHistory(line) + +def get_history_length(): + return _reader.history.maxSize + +def set_history_length(length): + _reader.history.maxSize = length + +def get_current_history_length(): + return len(_reader.history.historyList) + +def get_history_item(index): + return _reader.history.historyList[index] + +def remove_history_item(pos): + if _history_list: + _history_list.remove(pos) + else: + warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning, stacklevel=2) + +def redisplay(): + _reader.redrawLine() + +def set_startup_hook(function=None): + sys._jy_interpreter.startupHook = function + +def set_pre_input_hook(function=None): + warn("set_pre_input_hook %s" % (function,), NotImplementedWarning, stacklevel=2) + +_completer_function = None + +def set_completer(function=None): + """set_completer([function]) -> None + Set or remove the completer function. + The function is called as function(text, state), + for state in 0, 1, 2, ..., until it returns a non-string. + It should return the next possible completion starting with 'text'.""" + + global _completer_function + _completer_function = function + + def complete_handler(buffer, cursor, candidates): + start = _get_delimited(buffer, cursor)[0] + delimited = buffer[start:cursor] + for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? + completion = None + try: + completion = function(delimited, state) + except: + pass + if completion: + candidates.add(completion) + else: + break + return start + + _reader.addCompletor(complete_handler) + + +def get_completer(): + return _completer_function + +def _get_delimited(buffer, cursor): + start = cursor + for i in xrange(cursor-1, -1, -1): + if buffer[i] in _completer_delims: + break + start = i + return start, cursor + +def get_begidx(): + return _get_delimited(str(_reader.cursorBuffer.buffer), _reader.cursorBuffer.cursor)[0] + +def get_endidx(): + return _get_delimited(str(_reader.cursorBuffer.buffer), _reader.cursorBuffer.cursor)[1] + +def set_completer_delims(string): + global _completer_delims, _completer_delims_set + _completer_delims = string + _completer_delims_set = set(string) + +def get_completer_delims(): + return _completer_delims + +set_completer_delims(' \t\n`~!@#$%^&*()-=+[{]}\\|;:\'",<>/?') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-24 23:23:11
|
Revision: 7178 http://jython.svn.sourceforge.net/jython/?rev=7178&view=rev Author: pjenvey Date: 2010-12-24 23:23:05 +0000 (Fri, 24 Dec 2010) Log Message: ----------- fix exit code of 0 on unhandled exceptions in non-interactive mode fixes #1682 Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/util/jython.java Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-12-24 23:17:07 UTC (rev 7177) +++ trunk/jython/NEWS 2010-12-24 23:23:05 UTC (rev 7178) @@ -5,6 +5,8 @@ - [ 1674 ] PDB crashes under the JSR-223 scripting engine - [ 1680 ] jython -c option is not parsed right - [ 1681 ] JSR-223, Jython 2.5.2 and implementing Java Interfaces from Python + - [ 1675 ] Jython exits prematurely when executing a file, thus killing Swing windows + - [ 1682 ] exit code of 0 on unhandled exception Jython 2.5.2rc2 Bugs Fixed Modified: trunk/jython/src/org/python/util/jython.java =================================================================== --- trunk/jython/src/org/python/util/jython.java 2010-12-24 23:17:07 UTC (rev 7177) +++ trunk/jython/src/org/python/util/jython.java 2010-12-24 23:23:05 UTC (rev 7178) @@ -262,10 +262,8 @@ return; } else { Py.printException(t); - if (!opts.interactive) { - interp.cleanup(); - System.exit(-1); - } + interp.cleanup(); + System.exit(-1); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-24 23:17:13
|
Revision: 7177 http://jython.svn.sourceforge.net/jython/?rev=7177&view=rev Author: pjenvey Date: 2010-12-24 23:17:07 +0000 (Fri, 24 Dec 2010) Log Message: ----------- don't force System.exit on a successful main thread exit, so we don't stop non-daemon threads Modified Paths: -------------- trunk/jython/src/org/python/util/jython.java Modified: trunk/jython/src/org/python/util/jython.java =================================================================== --- trunk/jython/src/org/python/util/jython.java 2010-12-24 02:36:59 UTC (rev 7176) +++ trunk/jython/src/org/python/util/jython.java 2010-12-24 23:17:07 UTC (rev 7177) @@ -160,7 +160,6 @@ if (!opts.fixInteractive || opts.interactive) { opts.interactive = ((PyFile)Py.defaultSystemState.stdin).isatty(); if (!opts.interactive) { - systemState.ps1 = systemState.ps2 = Py.EmptyString; } } @@ -243,7 +242,7 @@ if (PosixModule.getPOSIX().isatty(file.getFD())) { opts.interactive = true; interp.interact(null, new PyFile(file)); - System.exit(0); + return; } else { interp.execfile(file, opts.filename); } @@ -294,7 +293,7 @@ interp.set("name", Py.newString(opts.moduleName)); interp.exec("runpy.run_module(name, run_name='__main__', alter_sys=True)"); interp.cleanup(); - System.exit(0); + return; } catch (Throwable t) { Py.printException(t); interp.cleanup(); @@ -323,9 +322,6 @@ } } interp.cleanup(); - if (opts.fixInteractive || opts.interactive) { - System.exit(0); - } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-24 02:37:05
|
Revision: 7176 http://jython.svn.sourceforge.net/jython/?rev=7176&view=rev Author: pjenvey Date: 2010-12-24 02:36:59 +0000 (Fri, 24 Dec 2010) Log Message: ----------- forgot to commit this for r7175 Added Paths: ----------- trunk/jython/tests/java/org/python/jsr223/PythonCallable.java Added: trunk/jython/tests/java/org/python/jsr223/PythonCallable.java =================================================================== --- trunk/jython/tests/java/org/python/jsr223/PythonCallable.java (rev 0) +++ trunk/jython/tests/java/org/python/jsr223/PythonCallable.java 2010-12-24 02:36:59 UTC (rev 7176) @@ -0,0 +1,4 @@ +public interface PythonCallable { + String getAString(); + void callAVoid(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-24 01:37:08
|
Revision: 7175 http://jython.svn.sourceforge.net/jython/?rev=7175&view=rev Author: pjenvey Date: 2010-12-24 01:37:01 +0000 (Fri, 24 Dec 2010) Log Message: ----------- special case type objects in the jsr223 Scope assignment as we don't want their proxy objects fixes #1681 Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-12-24 00:34:31 UTC (rev 7174) +++ trunk/jython/NEWS 2010-12-24 01:37:01 UTC (rev 7175) @@ -4,6 +4,7 @@ Bugs Fixed - [ 1674 ] PDB crashes under the JSR-223 scripting engine - [ 1680 ] jython -c option is not parsed right + - [ 1681 ] JSR-223, Jython 2.5.2 and implementing Java Interfaces from Python Jython 2.5.2rc2 Bugs Fixed Modified: trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java =================================================================== --- trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java 2010-12-24 00:34:31 UTC (rev 7174) +++ trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java 2010-12-24 01:37:01 UTC (rev 7175) @@ -104,7 +104,9 @@ int scope = context.getAttributesScope(key); if (scope == -1) scope = ScriptContext.ENGINE_SCOPE; - context.setAttribute(key, value.__tojava__(Object.class), scope); + context.setAttribute(key, + value instanceof PyType ? value : value.__tojava__(Object.class), + scope); } @ExposedMethod Modified: trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java =================================================================== --- trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2010-12-24 00:34:31 UTC (rev 7174) +++ trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2010-12-24 01:37:01 UTC (rev 7175) @@ -249,5 +249,18 @@ pythonEngine.eval("arepr = `var_a`"); assertEquals("4", pythonEngine.get("arepr")); } + + public void testIssue1681() throws ScriptException{ + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine pythonEngine = manager.getEngineByName("python"); + pythonEngine.eval("import PythonCallable\n" + + "class MyPythonCallable(PythonCallable):\n" + + " def getAString(self): return 'a string'\n\n" + + "result = MyPythonCallable().getAString()\n" + + "test = MyPythonCallable()\n" + + "result2 = test.getAString()"); + assertEquals("a string", pythonEngine.get("result")); + assertEquals("a string", pythonEngine.get("result2")); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2010-12-24 00:34:38
|
Revision: 7174 http://jython.svn.sourceforge.net/jython/?rev=7174&view=rev Author: pjenvey Date: 2010-12-24 00:34:31 +0000 (Fri, 24 Dec 2010) Log Message: ----------- allow -c/-w options without a space separator fixes #1680 thanks Zemian Deng Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/util/jython.java Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-11-23 06:51:27 UTC (rev 7173) +++ trunk/jython/NEWS 2010-12-24 00:34:31 UTC (rev 7174) @@ -2,7 +2,8 @@ Jython 2.5.2rc3 Bugs Fixed - - [ 1674 ] PDB crashes under the JSR-223 scripting engine + - [ 1674 ] PDB crashes under the JSR-223 scripting engine + - [ 1680 ] jython -c option is not parsed right Jython 2.5.2rc2 Bugs Fixed Modified: trunk/jython/src/org/python/util/jython.java =================================================================== --- trunk/jython/src/org/python/util/jython.java 2010-11-23 06:51:27 UTC (rev 7173) +++ trunk/jython/src/org/python/util/jython.java 2010-12-24 00:34:31 UTC (rev 7174) @@ -436,7 +436,7 @@ Options.verbose +=3 ; } else if (arg.equals("-S")) { Options.importSite = false; - } else if (arg.equals("-c")) { + } else if (arg.startsWith("-c")) { runCommand = true; if (arg.length() > 2) { command = arg.substring(2); @@ -453,7 +453,7 @@ } index++; break; - } else if (arg.equals("-W")) { + } else if (arg.startsWith("-W")) { warnoptions.add(args[++index]); } else if (arg.equals("-C")) { encoding = args[++index]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2010-11-23 06:51:33
|
Revision: 7173 http://jython.svn.sourceforge.net/jython/?rev=7173&view=rev Author: fwierzbicki Date: 2010-11-23 06:51:27 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Use https in case of firewall blockage. Property Changed: ---------------- trunk/jython/ Property changes on: trunk/jython ___________________________________________________________________ Modified: svn:externals - CPythonLib -r70085 http://svn.python.org/projects/python/branches/release25-maint/Lib/ + CPythonLib -r70085 https://svn.python.org/projects/python/branches/release25-maint/Lib/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2010-11-17 20:44:52
|
Revision: 7172 http://jython.svn.sourceforge.net/jython/?rev=7172&view=rev Author: otmarhumbel Date: 2010-11-17 20:44:46 +0000 (Wed, 17 Nov 2010) Log Message: ----------- prevent null pointer exception Modified Paths: -------------- trunk/jython/src/org/python/core/PyType.java Modified: trunk/jython/src/org/python/core/PyType.java =================================================================== --- trunk/jython/src/org/python/core/PyType.java 2010-11-10 00:16:37 UTC (rev 7171) +++ trunk/jython/src/org/python/core/PyType.java 2010-11-17 20:44:46 UTC (rev 7172) @@ -1202,7 +1202,7 @@ } static boolean hasBuilder(Class<?> c) { - return classToBuilder.containsKey(c); + return classToBuilder != null && classToBuilder.containsKey(c); } private static TypeBuilder getBuilder(Class<?> c) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2010-11-10 00:16:43
|
Revision: 7171 http://jython.svn.sourceforge.net/jython/?rev=7171&view=rev Author: otmarhumbel Date: 2010-11-10 00:16:37 +0000 (Wed, 10 Nov 2010) Log Message: ----------- add the latest contributors to both acknowledgements Modified Paths: -------------- trunk/jython/ACKNOWLEDGMENTS trunk/website/redirects/acknowledgments.txt Modified: trunk/jython/ACKNOWLEDGMENTS =================================================================== --- trunk/jython/ACKNOWLEDGMENTS 2010-11-09 22:55:15 UTC (rev 7170) +++ trunk/jython/ACKNOWLEDGMENTS 2010-11-10 00:16:37 UTC (rev 7171) @@ -88,10 +88,10 @@ Leonardo Soto James Robinson Jonathan Feinberg + Josh Juneau Justin Deoliveira Costantino Cerbo - Alex Gr\xF6nholm - Jonathan Feinberg + Alex Groenholm Anselm Kruis Local Variables: Modified: trunk/website/redirects/acknowledgments.txt =================================================================== --- trunk/website/redirects/acknowledgments.txt 2010-11-09 22:55:15 UTC (rev 7170) +++ trunk/website/redirects/acknowledgments.txt 2010-11-10 00:16:37 UTC (rev 7171) @@ -136,7 +136,15 @@ Josh Juneau + Justin Deoliveira + Costantino Cerbo + + Alex Groenholm + + Anselm Kruis + + YourKit is kindly supporting open source projects with its full-featured Java Profiler. YourKit, LLC is creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit .NET Profiler. Logo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2010-11-09 22:55:22
|
Revision: 7170 http://jython.svn.sourceforge.net/jython/?rev=7170&view=rev Author: otmarhumbel Date: 2010-11-09 22:55:15 +0000 (Tue, 09 Nov 2010) Log Message: ----------- allow PyStringMap to be bootstrapped without a warning; fixes issue #1671 Modified Paths: -------------- trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/core/PyType.java trunk/jython/src/org/python/util/PyServlet.java trunk/jython/src/org/python/util/PythonInterpreter.java trunk/jython/src/org/python/util/jython.java Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2010-11-06 00:15:33 UTC (rev 7169) +++ trunk/jython/src/org/python/core/Py.java 2010-11-09 22:55:15 UTC (rev 7170) @@ -576,6 +576,14 @@ return new PyString(s); } + public static PyStringMap newStringMap() { + // enable lazy bootstrapping (see issue #1671) + if (!PyType.hasBuilder(PyStringMap.class)) { + BOOTSTRAP_TYPES.add(PyStringMap.class); + } + return new PyStringMap(); + } + public static PyUnicode newUnicode(char c) { return (PyUnicode) makeCharacter(c, true); } Modified: trunk/jython/src/org/python/core/PyType.java =================================================================== --- trunk/jython/src/org/python/core/PyType.java 2010-11-06 00:15:33 UTC (rev 7169) +++ trunk/jython/src/org/python/core/PyType.java 2010-11-09 22:55:15 UTC (rev 7170) @@ -1201,6 +1201,10 @@ return createType(c, needsInners); } + static boolean hasBuilder(Class<?> c) { + return classToBuilder.containsKey(c); + } + private static TypeBuilder getBuilder(Class<?> c) { if (classToBuilder == null) { // PyType itself has yet to be initialized. This should be a bootstrap type, so it'll Modified: trunk/jython/src/org/python/util/PyServlet.java =================================================================== --- trunk/jython/src/org/python/util/PyServlet.java 2010-11-06 00:15:33 UTC (rev 7169) +++ trunk/jython/src/org/python/util/PyServlet.java 2010-11-09 22:55:15 UTC (rev 7170) @@ -121,7 +121,7 @@ protected static PythonInterpreter createInterpreter(ServletContext servletContext) { String rootPath = getRootPath(servletContext); PySystemState sys = new PySystemState(); - PythonInterpreter interp = new PythonInterpreter(new PyStringMap(), sys); + PythonInterpreter interp = new PythonInterpreter(Py.newStringMap(), sys); sys.path.append(new PyString(rootPath)); String modulesDir = rootPath + "WEB-INF" + File.separator + "jython"; Modified: trunk/jython/src/org/python/util/PythonInterpreter.java =================================================================== --- trunk/jython/src/org/python/util/PythonInterpreter.java 2010-11-06 00:15:33 UTC (rev 7169) +++ trunk/jython/src/org/python/util/PythonInterpreter.java 2010-11-09 22:55:15 UTC (rev 7170) @@ -94,7 +94,7 @@ protected PythonInterpreter(PyObject dict, PySystemState systemState, boolean useThreadLocalState) { if (dict == null) { - dict = new PyStringMap(); + dict = Py.newStringMap(); } globals = dict; Modified: trunk/jython/src/org/python/util/jython.java =================================================================== --- trunk/jython/src/org/python/util/jython.java 2010-11-06 00:15:33 UTC (rev 7169) +++ trunk/jython/src/org/python/util/jython.java 2010-11-09 22:55:15 UTC (rev 7170) @@ -98,7 +98,7 @@ throw Py.ValueError("jar file missing '__run__.py'"); } - PyStringMap locals = new PyStringMap(); + PyStringMap locals = Py.newStringMap(); // Stripping the stuff before the last File.separator fixes Bug #931129 by // keeping illegal characters out of the generated proxy class name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2010-11-06 00:15:39
|
Revision: 7169 http://jython.svn.sourceforge.net/jython/?rev=7169&view=rev Author: otmarhumbel Date: 2010-11-06 00:15:33 +0000 (Sat, 06 Nov 2010) Log Message: ----------- let the engine scope behave more like locals and globals; fixes issue #1674 Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-10-24 21:44:54 UTC (rev 7168) +++ trunk/jython/NEWS 2010-11-06 00:15:33 UTC (rev 7169) @@ -1,5 +1,9 @@ Jython NEWS +Jython 2.5.2rc3 + Bugs Fixed + - [ 1674 ] PDB crashes under the JSR-223 scripting engine + Jython 2.5.2rc2 Bugs Fixed - [ 1665 ] cPickle calls __import__ with illegal parameters Modified: trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java =================================================================== --- trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java 2010-10-24 21:44:54 UTC (rev 7168) +++ trunk/jython/src/org/python/jsr223/PyScriptEngineScope.java 2010-11-06 00:15:33 UTC (rev 7169) @@ -1,10 +1,15 @@ package org.python.jsr223; +import java.util.HashMap; import java.util.List; +import java.util.Map; + import javax.script.Bindings; import javax.script.ScriptContext; import javax.script.ScriptEngine; import org.python.core.Py; +import org.python.core.PyDictionary; +import org.python.core.PyIterator; import org.python.core.PyList; import org.python.core.PyObject; import org.python.core.PyString; @@ -56,16 +61,31 @@ return members; } - // Not necessary for functionality; present to satisfy __builtin__.PyMapping_check + // satisfy mapping and lookup @ExposedMethod + @Override public PyObject __getitem__(PyObject key) { - return super.__getitem__(key); + return __finditem__(key); } + // satisfy iterable + @ExposedMethod + @Override + public PyObject __iter__() { + return new ScopeIterator(this); + } + + @Override + public String toString() { + return getDictionary().toString(); + } + + @Override public PyObject __finditem__(PyObject key) { return __finditem__(key.asString()); } + @Override public PyObject __finditem__(String key) { int scope = context.getAttributesScope(key); if (scope == -1) @@ -74,10 +94,12 @@ } @ExposedMethod + @Override public void __setitem__(PyObject key, PyObject value) { __setitem__(key.asString(), value); } + @Override public void __setitem__(String key, PyObject value) { int scope = context.getAttributesScope(key); if (scope == -1) @@ -86,14 +108,57 @@ } @ExposedMethod + @Override public void __delitem__(PyObject key) { __delitem__(key.asString()); } + @Override public void __delitem__(String key) { int scope = context.getAttributesScope(key); if (scope == -1) throw Py.KeyError(key); context.removeAttribute(key, scope); } + + private Map<PyObject, PyObject> getMap() { + ScopeIterator iterator = new ScopeIterator(this); + Map<PyObject, PyObject> map = new HashMap<PyObject, PyObject>(iterator.size()); + PyObject key = iterator.__iternext__(); + while (key != null) { + map.put(key, __finditem__(key)); + key = iterator.__iternext__(); + } + return map; + } + + private PyDictionary getDictionary() { + return new PyDictionary(getMap()); + } + + public class ScopeIterator extends PyIterator { + private int _index; + private int _size; + private PyObject _keys; + + ScopeIterator(PyScriptEngineScope scope) { + _keys = scope.scope_keys(); + _size = _keys.__len__(); + _index = -1; + } + + public int size() { + return _size; + } + + @Override + public PyObject __iternext__() { + PyObject result = null; + _index++; + if (_index < size()) { + result = _keys.__getitem__(_index); + } + return result; + } + } } Modified: trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java =================================================================== --- trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2010-10-24 21:44:54 UTC (rev 7168) +++ trunk/jython/tests/java/org/python/jsr223/ScriptEngineTest.java 2010-11-06 00:15:33 UTC (rev 7169) @@ -206,4 +206,48 @@ Object newStringCapitalize = invocableEngine.invokeMethod("test", "capitalize"); assertEquals(newStringCapitalize, "Test"); } + + public void testPdb() { + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine pythonEngine = manager.getEngineByName("python"); + // String from issue 1674 + String pdbString = "from pdb import set_trace; set_trace()"; + try { + pythonEngine.eval(pdbString); + fail("bdb.BdbQuit expected"); + } catch (ScriptException e) { + assertTrue(e.getMessage().startsWith("bdb.BdbQuit")); + } + } + + public void testScope_repr() throws ScriptException { + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine pythonEngine = manager.getEngineByName("python"); + pythonEngine.eval("a = 4"); + pythonEngine.eval("b = 'hi'"); + pythonEngine.eval("localrepr = `locals()`"); + assertEquals("{'b': u'hi', 'a': 4}", pythonEngine.get("localrepr")); + } + + public void testScope_iter() throws ScriptException { + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine pythonEngine = manager.getEngineByName("python"); + pythonEngine.eval("a = 4"); + pythonEngine.eval("b = 'hi'"); + pythonEngine.eval("list = []"); + pythonEngine.eval("for loc in locals(): list.append(loc)"); + pythonEngine.eval("listrepr = `list`"); + assertEquals("[u'a', u'b', u'list']", pythonEngine.get("listrepr")); + } + + public void testScope_lookup() throws ScriptException{ + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine pythonEngine = manager.getEngineByName("python"); + pythonEngine.eval("a = 4"); + pythonEngine.eval("b = 'hi'"); + pythonEngine.eval("var_a = locals()['a']"); + pythonEngine.eval("arepr = `var_a`"); + assertEquals("4", pythonEngine.get("arepr")); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2010-10-24 21:45:00
|
Revision: 7168 http://jython.svn.sourceforge.net/jython/?rev=7168&view=rev Author: otmarhumbel Date: 2010-10-24 21:44:54 +0000 (Sun, 24 Oct 2010) Log Message: ----------- website preparation for 2.5.2rc2 Modified Paths: -------------- trunk/jython/README.txt trunk/website/index.txt trunk/website/jysite.py trunk/website/redirects/downloads.txt trunk/website/redirects/latest.txt Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2010-10-24 20:39:41 UTC (rev 7167) +++ trunk/jython/README.txt 2010-10-24 21:44:54 UTC (rev 7168) @@ -1,4 +1,4 @@ -Welcome to Jython 2.5.2 rc1 +Welcome to Jython 2.5.2 rc2 =========================== This is the second release candidate of the 2.5.2 version of Jython. Modified: trunk/website/index.txt =================================================================== --- trunk/website/index.txt 2010-10-24 20:39:41 UTC (rev 7167) +++ trunk/website/index.txt 2010-10-24 21:44:54 UTC (rev 7168) @@ -4,6 +4,10 @@ Latest News ~~~~~~~~~~~ +**Jython 2.5.2 RC 2 Has Been Released** (October 24, 2010) + +The Jython development team would like to announce the release of 2.5.2 Release Candidate 2. For a complete listing of changes, please visit the `Release Notes`_. + **Jython 2.5.2 RC 1 Has Been Released** (October 18, 2010) The Jython development team would like to announce the release of 2.5.2 Release Candidate 1. For a complete listing of changes, please visit the `Release Notes`_. @@ -89,7 +93,7 @@ .. _this post: http://blog.springpython.webfactional.com/2009/10/15/see-how-spring-python-works-with-jython/ .. _Release Notes: http://www.jython.org/latest.html .. _the bug tracker: http://bugs.jython.org -.. _download the installer by clicking here: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc1/jython_installer-2.5.2rc1.jar/download +.. _download the installer by clicking here: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc2/jython_installer-2.5.2rc2.jar/download Modified: trunk/website/jysite.py =================================================================== --- trunk/website/jysite.py 2010-10-24 20:39:41 UTC (rev 7167) +++ trunk/website/jysite.py 2010-10-24 21:44:54 UTC (rev 7168) @@ -80,9 +80,9 @@ buffer.append('<a href="./" ><img class="logoImage" alt="Jython" style="border: 0px; padding-top: 20px; position:absolute; left: 35px" src="css/jython.png" title="Jython"></a>') buffer.append('</div>') buffer.append('<div class="latest_release" style="position:absolute; color:#000; width:180px; top: 15px; right: 30px; padding:0px 10px 10px 30px; font-size:11px; background:url(\'css/latest_release_bg.png\') no-repeat">') - buffer.append('<p style="top: 25px; color:#000">Latest release - 2.5.2 - RC 1<br/>') + buffer.append('<p style="top: 25px; color:#000">Latest release - 2.5.2 - RC 2<br/>') buffer.append('<a style="color:#000" href="latest.html">View Release Notes</a><br/>') - buffer.append('Download: <a style="color:#000" href="http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc1/jython_installer-2.5.2rc1.jar/download">.jar</a>') + buffer.append('Download: <a style="color:#000" href="http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc2/jython_installer-2.5.2rc2.jar/download">.jar</a>') buffer.append('</div>') buffer.append('<div class="searchbox">') Modified: trunk/website/redirects/downloads.txt =================================================================== --- trunk/website/redirects/downloads.txt 2010-10-24 20:39:41 UTC (rev 7167) +++ trunk/website/redirects/downloads.txt 2010-10-24 21:44:54 UTC (rev 7168) @@ -1,14 +1,14 @@ Downloads --------- -The current version of Jython is 2.5.2 - Release Candidate 1, please use the link below to download the Java installer. +The current version of Jython is 2.5.2 - Release Candidate 2, please use the link below to download the Java installer. Once downloaded, please double-click on the JAR file to start the installation process. You may also want to read the `Installation instructions`_ or the `Release Notes`_. -`Download Jython 2.5.2`_ RC 1 +`Download Jython 2.5.2`_ RC 2 -- MD5: ``4067d89c58d5596ce85611b2defd0333`` -- SHA1: ``6545eda94e5f3a55cc392c59d1ffa683e094eca3`` +- MD5: ``3f03c9c5a7541d6c47b9beb17777860b`` +- SHA1: ``bc38e7910ff221e260401b84b995a1ad970680b3`` Previous Releases ----------------- @@ -28,7 +28,7 @@ - MD5: ``774543534bef2d68247953882237d448`` - SHA1: ``6fea1e8985af955fc843789e2d60fcfc38a76fd8`` -.. _Download Jython 2.5.2: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc1/jython_installer-2.5.2rc1.jar/download +.. _Download Jython 2.5.2: http://sourceforge.net/projects/jython/files/jython-dev/2.5.2rc2/jython_installer-2.5.2rc2.jar/download .. _Jython 2.5.1: http://sourceforge.net/projects/jython/files/jython/2.5.1/jython_installer-2.5.1.jar/download .. _Jython 2.5.0: http://sourceforge.net/projects/jython/files/jython/2.5.0/jython_installer-2.5.0.jar/download .. _Jython 2.2.1: http://sourceforge.net/projects/jython/files/jython/jython_installer-2.2.1.jar Modified: trunk/website/redirects/latest.txt =================================================================== --- trunk/website/redirects/latest.txt 2010-10-24 20:39:41 UTC (rev 7167) +++ trunk/website/redirects/latest.txt 2010-10-24 21:44:54 UTC (rev 7168) @@ -6,6 +6,12 @@ Bugs Fixed ---------- +2.5.2-rc2 +~~~~~~~~~ + - [ 1665 ] cPickle calls __import__ with illegal parameters + - [ 1628 ] getpass.getpass echoes input + - Fix logic to detect that a console is interactive (related to #1133) + 2.5.2-rc1 ~~~~~~~~~ - [ 1133 ] Support ipython and other completers with readline emulation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |