Custom Search
|
Date: December 31, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3038
http://svn.sourceforge.net/jython/?rev=3038&view=rev
Author: cgroves
Date: 2006-12-31 13:29:19 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
Commit of akuchling's fix for bug #1599004
Things fixed from his message:
* SHA and MD5 objects lack a .digest_size attribute.
* Successive calls to digest() return different values.
* For digest(), the byte array is converted to a string using the default
encoding, which produces weird results if it's UTF-8. It should hardwire using
ISO-8859-1, because we want a 1-to-1 mapping of characters.
I also added a to_bytes method to PyString that handles getting the bytes to
add to a digest. It takes a String an returns a byte array and will throw an
exception if there are for values in the string above 255. Using
getBytes("ISO-8859-1") just skips over illegal values.
Modified Paths:
--------------
trunk/jython/src/org/python/core/PyString.java
trunk/jython/src/org/python/modules/MD5Object.java
trunk/jython/src/org/python/modules/SHA1.java
trunk/jython/src/org/python/modules/sha.java
Modified: trunk/jython/src/org/python/core/PyString.java
===================================================================
--- trunk/jython/src/org/python/core/PyString.java 2006-12-31 21:23:44 UTC
(rev 3037)
+++ trunk/jython/src/org/python/core/PyString.java 2006-12-31 21:29:19 UTC
(rev 3038)
@@ -3217,13 +3217,21 @@
}
private byte[] getBytes() {
- byte[] buf = new byte[string.length()];
- string.getBytes(0, string.length(), buf, 0);
- return buf;
- //XXX: would rather not use above getBytes since it is deprecated,
- // but that breaks zlib.py -- need to figure out why and fix.
- //return string.getBytes();
+ return to_bytes(string);
}
+
+ public static byte[] to_bytes(String s){
+ byte[] bytes = new byte[s.length()];
+ for(int i = 0; i < bytes.length; i++) {
+ char c = s.charAt(i);
+ if(c < 256){
+ bytes[i] = (byte)c;
+ }else{
+ throw Py.ValueError("Strings added to sha hashes must not
contain characters with value > 255");
+ }
+ }
+ return bytes;
+ }
public Object __tojava__(Class c) {
if (c.isAssignableFrom(String.class)) {
Modified: trunk/jython/src/org/python/modules/MD5Object.java
===================================================================
--- trunk/jython/src/org/python/modules/MD5Object.java 2006-12-31 21:23:44 UTC
(rev 3037)
+++ trunk/jython/src/org/python/modules/MD5Object.java 2006-12-31 21:29:19 UTC
(rev 3038)
@@ -9,6 +9,8 @@
{
private String data;
+ public int digest_size = 16;
+
public MD5Object(String s) {
data = s;
}
Modified: trunk/jython/src/org/python/modules/SHA1.java
===================================================================
--- trunk/jython/src/org/python/modules/SHA1.java 2006-12-31 21:23:44 UTC
(rev 3037)
+++ trunk/jython/src/org/python/modules/SHA1.java 2006-12-31 21:29:19 UTC
(rev 3038)
@@ -43,7 +43,8 @@
package org.python.modules;
-import org.python.core.PyString;
+import java.io.UnsupportedEncodingException;
+import org.python.core.*;
/**
* This class implements the SHA-1 message digest algorithm.
@@ -89,9 +90,9 @@
*/
private long count;
+ public int digest_size = 20;
-
/**
* <b>SPI</b>: Updates the message digest with a byte of new data.
*
@@ -162,9 +163,6 @@
private byte[] tmp;
private int[] w;
- private byte[] digestBits;
-
-
/**
* Constructs a SHA-1 message digest.
*/
@@ -242,14 +240,14 @@
protected byte[] engineDigest(byte[] in, int length)
{
byte b[] = java_digest(in, length);
- engineReset();
return b;
}
private byte[] java_digest(byte[] in, int pos)
{
+ int[] digest_save = (int[]) digest.clone();
if (pos != 0) System.arraycopy(in, 0, tmp, 0, pos);
-
+
tmp[pos++] = (byte)0x80;
if (pos > DATA_LENGTH - 8)
@@ -287,6 +285,7 @@
buf[off++] = (byte) (d>>>8);
buf[off++] = (byte) d;
}
+ digest = digest_save;
return buf;
}
@@ -471,8 +470,7 @@
* to the test vectors.
*/
public String hexdigest() {
- if (digestBits == null)
- digestBits = engineDigest();
+ byte[] digestBits = engineDigest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 20; i++) {
@@ -494,9 +492,12 @@
);
public String digest() {
- if (digestBits == null)
- digestBits = engineDigest();
- return new String(digestBits);
+ byte[] digestBits = engineDigest();
+ try {
+ return new String(digestBits, "ISO-8859-1");
+ } catch (UnsupportedEncodingException exc) {
+ throw Py.ValueError("encoding not supported");
+ }
}
// XXX should become PyObject and use Py.idstr?
Modified: trunk/jython/src/org/python/modules/sha.java
===================================================================
--- trunk/jython/src/org/python/modules/sha.java 2006-12-31 21:23:44 UTC
(rev 3037)
+++ trunk/jython/src/org/python/modules/sha.java 2006-12-31 21:29:19 UTC
(rev 3038)
@@ -2,13 +2,10 @@
package org.python.modules;
+import java.io.UnsupportedEncodingException;
import org.python.core.*;
-public class sha {
- public int blocksize = 1;
- public int digestsize = 20;
- public int digest_size = digestsize;
-
+public class sha implements ClassDictInit {
public static String __doc__ =
"* Cryptix General License\n" +
"* Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 The Cryptix"+
@@ -45,10 +42,10 @@
public static SHA1 new$(PyObject[] args, String[] kws) {
ArgParser ap = new ArgParser("sha", args, kws, "string");
String cp = ap.getString(0, null);
-
SHA1 n = new SHA1();
- if (cp != null)
- n.update(cp.getBytes());
+ if(cp != null) {
+ n.update(PyString.to_bytes(cp));
+ }
return n;
}
@@ -56,4 +53,11 @@
public static SHA1 sha$(PyObject[] args, String[] kws) {
return new$(args, kws);
}
+
+ public static void classDictInit(PyObject dict) {
+ dict.__setitem__("digest_size", Py.newInteger(20));
+ dict.__setitem__("digestsize", Py.newInteger(20));
+ dict.__setitem__("blocksize", Py.newInteger(1));
+ dict.__setitem__("classDictInit", null);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 31, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3037
http://svn.sourceforge.net/jython/?rev=3037&view=rev
Author: cgroves
Date: 2006-12-31 13:23:44 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
actually close the files open inside of the created messages so they will be
deleted when the tests run under Windows
Modified Paths:
--------------
trunk/jython/Lib/test/test_mailbox.py
Modified: trunk/jython/Lib/test/test_mailbox.py
===================================================================
--- trunk/jython/Lib/test/test_mailbox.py 2006-12-31 21:19:08 UTC (rev
3036)
+++ trunk/jython/Lib/test/test_mailbox.py 2006-12-31 21:23:44 UTC (rev
3037)
@@ -57,6 +57,15 @@
fp.close()
self._msgfiles.append(newname)
+ def assert_msg_exists(self):
+ msg = self.mbox.next()
+ self.assert_(msg is not None)
+ #Force the file closed on Jython since Windows won't allow a file to
+ #be deleted if something has an open handle on it and garbage
collection
+ #doesn't happen quickly enough to make this occur naturally
+ if os.name == 'java':
+ msg.fp.close()
+
def test_empty_maildir(self):
"""Test an empty maildir mailbox"""
# Test for regression on bug #117490:
@@ -71,7 +80,7 @@
self.createMessage("cur")
self.mbox = mailbox.Maildir(test_support.TESTFN)
self.assert_(len(self.mbox.boxes) == 1)
- self.assert_(self.mbox.next() is not None)
+ self.assert_msg_exists()
self.assert_(self.mbox.next() is None)
self.assert_(self.mbox.next() is None)
@@ -79,7 +88,7 @@
self.createMessage("new")
self.mbox = mailbox.Maildir(test_support.TESTFN)
self.assert_(len(self.mbox.boxes) == 1)
- self.assert_(self.mbox.next() is not None)
+ self.assert_msg_exists()
self.assert_(self.mbox.next() is None)
self.assert_(self.mbox.next() is None)
@@ -88,8 +97,8 @@
self.createMessage("new")
self.mbox = mailbox.Maildir(test_support.TESTFN)
self.assert_(len(self.mbox.boxes) == 2)
- self.assert_(self.mbox.next() is not None)
- self.assert_(self.mbox.next() is not None)
+ self.assert_msg_exists()
+ self.assert_msg_exists()
self.assert_(self.mbox.next() is None)
self.assert_(self.mbox.next() is None)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 31, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3036
http://svn.sourceforge.net/jython/?rev=3036&view=rev
Author: cgroves
Date: 2006-12-31 13:19:08 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
pulled over from CPython's release22-maint branch at revision 53203
Revision Links:
--------------
http://svn.sourceforge.net/jython/?rev=53203&view=rev
Added Paths:
-----------
trunk/jython/Lib/test/test_mailbox.py
Added: trunk/jython/Lib/test/test_mailbox.py
===================================================================
--- trunk/jython/Lib/test/test_mailbox.py (rev 0)
+++ trunk/jython/Lib/test/test_mailbox.py 2006-12-31 21:19:08 UTC (rev
3036)
@@ -0,0 +1,104 @@
+import mailbox
+import os
+import test_support
+import time
+import unittest
+
+# cleanup earlier tests
+try:
+ os.unlink(test_support.TESTFN)
+except os.error:
+ pass
+
+
+DUMMY_MESSAGE = """\
+From: some.body@xxxxxxxxxxxx
+To: me@xxxxxxxxx
+
+This is a dummy message.
+"""
+
+
+class MaildirTestCase(unittest.TestCase):
+
+ def setUp(self):
+ # create a new maildir mailbox to work with:
+ self._dir = test_support.TESTFN
+ os.mkdir(self._dir)
+ os.mkdir(os.path.join(self._dir, "cur"))
+ os.mkdir(os.path.join(self._dir, "tmp"))
+ os.mkdir(os.path.join(self._dir, "new"))
+ self._counter = 1
+ self._msgfiles = []
+
+ def tearDown(self):
+ map(os.unlink, self._msgfiles)
+ os.rmdir(os.path.join(self._dir, "cur"))
+ os.rmdir(os.path.join(self._dir, "tmp"))
+ os.rmdir(os.path.join(self._dir, "new"))
+ os.rmdir(self._dir)
+
+ def createMessage(self, dir):
+ t = int(time.time() % 1000000)
+ pid = self._counter
+ self._counter += 1
+ filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain"))
+ tmpname = os.path.join(self._dir, "tmp", filename)
+ newname = os.path.join(self._dir, dir, filename)
+ fp = open(tmpname, "w")
+ self._msgfiles.append(tmpname)
+ fp.write(DUMMY_MESSAGE)
+ fp.close()
+ if hasattr(os, "link"):
+ os.link(tmpname, newname)
+ else:
+ fp = open(newname, "w")
+ fp.write(DUMMY_MESSAGE)
+ fp.close()
+ self._msgfiles.append(newname)
+
+ def test_empty_maildir(self):
+ """Test an empty maildir mailbox"""
+ # Test for regression on bug #117490:
+ # Make sure the boxes attribute actually gets set.
+ self.mbox = mailbox.Maildir(test_support.TESTFN)
+ self.assert_(hasattr(self.mbox, "boxes"))
+ self.assert_(len(self.mbox.boxes) == 0)
+ self.assert_(self.mbox.next() is None)
+ self.assert_(self.mbox.next() is None)
+
+ def test_nonempty_maildir_cur(self):
+ self.createMessage("cur")
+ self.mbox = mailbox.Maildir(test_support.TESTFN)
+ self.assert_(len(self.mbox.boxes) == 1)
+ self.assert_(self.mbox.next() is not None)
+ self.assert_(self.mbox.next() is None)
+ self.assert_(self.mbox.next() is None)
+
+ def test_nonempty_maildir_new(self):
+ self.createMessage("new")
+ self.mbox = mailbox.Maildir(test_support.TESTFN)
+ self.assert_(len(self.mbox.boxes) == 1)
+ self.assert_(self.mbox.next() is not None)
+ self.assert_(self.mbox.next() is None)
+ self.assert_(self.mbox.next() is None)
+
+ def test_nonempty_maildir_both(self):
+ self.createMessage("cur")
+ self.createMessage("new")
+ self.mbox = mailbox.Maildir(test_support.TESTFN)
+ self.assert_(len(self.mbox.boxes) == 2)
+ self.assert_(self.mbox.next() is not None)
+ self.assert_(self.mbox.next() is not None)
+ self.assert_(self.mbox.next() is None)
+ self.assert_(self.mbox.next() is None)
+
+ # XXX We still need more tests!
+
+
+def test_main():
+ test_support.run_unittest(MaildirTestCase)
+
+
+if __name__ == "__main__":
+ test_main()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 31, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3035
http://svn.sourceforge.net/jython/?rev=3035&view=rev
Author: cgroves
Date: 2006-12-31 13:16:52 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
swap \ for / in the path for checking against system id since its a URL
Modified Paths:
--------------
trunk/jython/Lib/test/test_sax.py
Modified: trunk/jython/Lib/test/test_sax.py
===================================================================
--- trunk/jython/Lib/test/test_sax.py 2006-12-31 21:16:10 UTC (rev 3034)
+++ trunk/jython/Lib/test/test_sax.py 2006-12-31 21:16:52 UTC (rev 3035)
@@ -470,9 +470,16 @@
xmlgen = LocatorTest(result)
parser = make_parser()
parser.setContentHandler(xmlgen)
- parser.parse(findfile("test.xml"))
+ testfile = findfile("test.xml")
+ parser.parse(testfile)
+ #In Jython, the system id is a URL with forward slashes, and under Windows
+ #findfile returns a path with backslashes, so replace the backslashes with
+ #forward
+ import os
+ if os.name == 'java':
+ testfile = testfile.replace('\\', '/')
- return xmlgen.location.getSystemId().endswith(findfile("test.xml")) and \
+ return xmlgen.location.getSystemId().endswith(testfile) and \
xmlgen.location.getPublicId() is None
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 31, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3034
http://svn.sourceforge.net/jython/?rev=3034&view=rev
Author: cgroves
Date: 2006-12-31 13:16:10 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
as _test points out earlier, more on windows does some weird things with
appending whitespace, so use strip on the results for an accurate comparision
Modified Paths:
--------------
trunk/jython/Lib/popen2.py
Modified: trunk/jython/Lib/popen2.py
===================================================================
--- trunk/jython/Lib/popen2.py 2006-12-31 18:58:00 UTC (rev 3033)
+++ trunk/jython/Lib/popen2.py 2006-12-31 21:16:10 UTC (rev 3034)
@@ -295,7 +295,7 @@
r = p.fromchild.read()
x = p.poll()
assert x == 0
- assert r == q
+ assert r.strip() == q.strip()
if __name__ == '__main__':
_test()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 31, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3033
http://svn.sourceforge.net/jython/?rev=3033&view=rev
Author: cgroves
Date: 2006-12-31 10:58:00 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
Don't check that __class__ of True can't be set to int. Shouldn't be merged to
the 2.3 branch
Modified Paths:
--------------
trunk/jython/Lib/test/test_descr.py
Modified: trunk/jython/Lib/test/test_descr.py
===================================================================
--- trunk/jython/Lib/test/test_descr.py 2006-12-28 15:10:57 UTC (rev 3032)
+++ trunk/jython/Lib/test/test_descr.py 2006-12-31 18:58:00 UTC (rev 3033)
@@ -2610,7 +2610,6 @@
class Int(int): __slots__ = []
cant(2, Int)
cant(Int(), int)
- cant(True, int)
cant(2, bool)
o = object()
cant(o, type(1))
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 31, 2006
From: "Charlie Groves" <charlie.groves@xxxxxxxxx>
In-reply-to:
<E1Gzwu9-0005cf-RW@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
References:
<E1Gzwu9-0005cf-RW@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
URLDecoder.decode(String url, String encoding) didn't appear until Java 1.4 so this doesn't compile for 1.2 or 1.3. They only have URLDecoder.decode(String url) Since the bug fixed with that encoding argument is in the 1.2 and 1.3 versions, I'm thinking we should revert this for trunk, but merge it over to the 2.3 branch where we can use Java 1.4 methods. Sound good? Charlie On 12/28/06, otmarhumbel@xxxxxxxxxxxxxxxxxxxxx <otmarhumbel@xxxxxxxxxxxxxxxxxxxxx> wrote: > Revision: 3031 > http://svn.sourceforge.net/jython/?rev=3031&view=rev > Author: otmarhumbel > Date: 2006-12-28 07:10:49 -0800 (Thu, 28 Dec 2006) > > Log Message: > ----------- > use URLDecoder instead of decoding "by hand" > > Modified Paths: > -------------- > trunk/jython/src/org/python/core/PySystemState.java > > Modified: trunk/jython/src/org/python/core/PySystemState.java > =================================================================== > --- trunk/jython/src/org/python/core/PySystemState.java 2006-12-28 15:02:02 > UTC (rev 3030) > +++ trunk/jython/src/org/python/core/PySystemState.java 2006-12-28 15:10:49 > UTC (rev 3031) > @@ -9,7 +9,9 @@ > import java.io.FilterInputStream; > import java.io.IOException; > import java.io.InputStream; > +import java.io.UnsupportedEncodingException; > import java.net.URL; > +import java.net.URLDecoder; > import java.security.AccessControlException; > import java.util.Enumeration; > import java.util.Hashtable; > @@ -31,7 +33,6 @@ > > private static final String JAR_URL_PREFIX = "jar:file:"; > private static final String JAR_SEPARATOR = "!"; > - private static final String URL_BLANK_REPLACEMENT = "%20"; > > private static final String PYTHON_CACHEDIR = "python.cachedir"; > protected static final String PYTHON_CACHEDIR_SKIP = > "python.cachedir.skip"; > @@ -668,20 +669,14 @@ > URL url = thisClass.getResource(className + ".class"); > // we expect an URL like > jar:file:/install_dir/jython.jar!/org/python/core/PySystemState.class > if (url != null) { > - String urlString = url.toString(); > - int jarSeparatorIndex = urlString.indexOf(JAR_SEPARATOR); > - if (urlString.startsWith(JAR_URL_PREFIX) && jarSeparatorIndex > > 0) { > - jarFileName = urlString.substring(JAR_URL_PREFIX.length(), > jarSeparatorIndex); > - // handle directories containing blanks > - // we can't use String.replaceAll before java 1.4, so > instead of the obvious: > - // jarFileName = > jarFileName.replaceAll(URL_BLANK_REPLACEMENT, " "); > - // apply repeated substitutions, which should be safe in > this case > - int URL_BLANK_LOCATION = > jarFileName.indexOf(URL_BLANK_REPLACEMENT); > - while (URL_BLANK_LOCATION >= 0) { > - jarFileName = jarFileName.substring(0, > URL_BLANK_LOCATION) + " " + > - jarFileName.substring(URL_BLANK_LOCATION + > URL_BLANK_REPLACEMENT.length()); > - URL_BLANK_LOCATION = > jarFileName.indexOf(URL_BLANK_REPLACEMENT); > + try { > + String urlString = URLDecoder.decode(url.toString(), > "UTF-8"); > + int jarSeparatorIndex = urlString.indexOf(JAR_SEPARATOR); > + if (urlString.startsWith(JAR_URL_PREFIX) && > jarSeparatorIndex > 0) { > + jarFileName = > urlString.substring(JAR_URL_PREFIX.length(), jarSeparatorIndex); > } > + } catch (UnsupportedEncodingException e) { > + // this is VERY unlikely - forget about standalone if it > happens > } > } > return jarFileName; > > > This was sent by the SourceForge.net collaborative development platform, the > world's largest Open Source development site. > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Jython-checkins mailing list > Jython-checkins@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/jython-checkins > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 28, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3032
http://svn.sourceforge.net/jython/?rev=3032&view=rev
Author: otmarhumbel
Date: 2006-12-28 07:10:57 -0800 (Thu, 28 Dec 2006)
Log Message:
-----------
use URLDecoder instead of decoding "by hand"
Modified Paths:
--------------
trunk/installer/src/java/org/python/util/install/JarInfo.java
Modified: trunk/installer/src/java/org/python/util/install/JarInfo.java
===================================================================
--- trunk/installer/src/java/org/python/util/install/JarInfo.java
2006-12-28 15:10:49 UTC (rev 3031)
+++ trunk/installer/src/java/org/python/util/install/JarInfo.java
2006-12-28 15:10:57 UTC (rev 3032)
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
+import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -22,7 +23,6 @@
private static final String VERSION_ATTRIBUTE = "version";
private static final String EXCLUDE_DIRS_ATTRIBUTE = "exclude-dirs";
private static final String EXCLUDE_DIRS_DELIM = ";";
- private static final String URL_BLANK_REPLACEMENT = "%20";
private File _jarFile;
private int _numberOfEntries;
@@ -111,16 +111,12 @@
URL url = getClass().getResource(className + ".class");
// we expect an URL like:
//
jar:file:/C:/stuff/jython21i.jar!/org/python/util/install/JarInfo.class
- String urlString = url.toString();
+ String urlString = URLDecoder.decode(url.toString(), "UTF-8");
int jarSeparatorIndex = urlString.indexOf(JAR_SEPARATOR);
if (!urlString.startsWith(JAR_URL_PREFIX) || jarSeparatorIndex <= 0) {
throw new
InstallerException(Installation.getText(TextKeys.UNEXPECTED_URL, urlString));
}
String jarFileName = urlString.substring(JAR_URL_PREFIX.length(),
jarSeparatorIndex);
- // handle directories containing blanks
- if (jarFileName.indexOf(URL_BLANK_REPLACEMENT) >= 0) {
- jarFileName = jarFileName.replaceAll(URL_BLANK_REPLACEMENT, " ");
- }
_jarFile = new File(jarFileName);
if (!_jarFile.exists()) {
throw new
InstallerException(Installation.getText(TextKeys.JAR_NOT_FOUND,
_jarFile.getAbsolutePath()));
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 28, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3031
http://svn.sourceforge.net/jython/?rev=3031&view=rev
Author: otmarhumbel
Date: 2006-12-28 07:10:49 -0800 (Thu, 28 Dec 2006)
Log Message:
-----------
use URLDecoder instead of decoding "by hand"
Modified Paths:
--------------
trunk/jython/src/org/python/core/PySystemState.java
Modified: trunk/jython/src/org/python/core/PySystemState.java
===================================================================
--- trunk/jython/src/org/python/core/PySystemState.java 2006-12-28 15:02:02 UTC
(rev 3030)
+++ trunk/jython/src/org/python/core/PySystemState.java 2006-12-28 15:10:49 UTC
(rev 3031)
@@ -9,7 +9,9 @@
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.URL;
+import java.net.URLDecoder;
import java.security.AccessControlException;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -31,7 +33,6 @@
private static final String JAR_URL_PREFIX = "jar:file:";
private static final String JAR_SEPARATOR = "!";
- private static final String URL_BLANK_REPLACEMENT = "%20";
private static final String PYTHON_CACHEDIR = "python.cachedir";
protected static final String PYTHON_CACHEDIR_SKIP =
"python.cachedir.skip";
@@ -668,20 +669,14 @@
URL url = thisClass.getResource(className + ".class");
// we expect an URL like
jar:file:/install_dir/jython.jar!/org/python/core/PySystemState.class
if (url != null) {
- String urlString = url.toString();
- int jarSeparatorIndex = urlString.indexOf(JAR_SEPARATOR);
- if (urlString.startsWith(JAR_URL_PREFIX) && jarSeparatorIndex > 0)
{
- jarFileName = urlString.substring(JAR_URL_PREFIX.length(),
jarSeparatorIndex);
- // handle directories containing blanks
- // we can't use String.replaceAll before java 1.4, so instead
of the obvious:
- // jarFileName =
jarFileName.replaceAll(URL_BLANK_REPLACEMENT, " ");
- // apply repeated substitutions, which should be safe in this
case
- int URL_BLANK_LOCATION =
jarFileName.indexOf(URL_BLANK_REPLACEMENT);
- while (URL_BLANK_LOCATION >= 0) {
- jarFileName = jarFileName.substring(0, URL_BLANK_LOCATION)
+ " " +
- jarFileName.substring(URL_BLANK_LOCATION +
URL_BLANK_REPLACEMENT.length());
- URL_BLANK_LOCATION =
jarFileName.indexOf(URL_BLANK_REPLACEMENT);
+ try {
+ String urlString = URLDecoder.decode(url.toString(), "UTF-8");
+ int jarSeparatorIndex = urlString.indexOf(JAR_SEPARATOR);
+ if (urlString.startsWith(JAR_URL_PREFIX) && jarSeparatorIndex
> 0) {
+ jarFileName = urlString.substring(JAR_URL_PREFIX.length(),
jarSeparatorIndex);
}
+ } catch (UnsupportedEncodingException e) {
+ // this is VERY unlikely - forget about standalone if it
happens
}
}
return jarFileName;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 28, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3030
http://svn.sourceforge.net/jython/?rev=3030&view=rev
Author: otmarhumbel
Date: 2006-12-28 07:02:02 -0800 (Thu, 28 Dec 2006)
Log Message:
-----------
fixed missing quotation under unix (if target directory contains a blank space)
Modified Paths:
--------------
trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java
Modified:
trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java
===================================================================
--- trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java
2006-12-26 19:56:13 UTC (rev 3029)
+++ trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java
2006-12-28 15:02:02 UTC (rev 3030)
@@ -154,7 +154,7 @@
*/
private String getUnixJythonTemplate() {
StringBuffer buffer = getUnixHeaderTemplate();
- buffer.append("CP={3}/" + JYTHON_JAR + "\n");
+ buffer.append("CP=\"{3}/" + JYTHON_JAR + "\"\n");
buffer.append("if [ ! -z \"$CLASSPATH\" ]\nthen\n
CP=$CP:$CLASSPATH\nfi\n");
buffer.append("\"{2}/bin/java\" -Dpython.home=\"{3}\" -classpath
\"$CP\" org.python.util.jython \"$@\"\n");
return buffer.toString();
@@ -216,7 +216,10 @@
*/
private void makeExecutable(File scriptFile) {
try {
- String command = "chmod" + " " + EXECUTABLE_MODE + " " +
scriptFile.getAbsolutePath();
+ String command[] = new String[3];
+ command[0] = "chmod";
+ command[1] = EXECUTABLE_MODE;
+ command[2] = scriptFile.getAbsolutePath();
long timeout = 3000;
ChildProcess childProcess = new ChildProcess(command, timeout);
childProcess.run();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 26, 2006
From: pedronis@xxxxxxxxxxxxxxxxxxxxx
Revision: 3029
http://svn.sourceforge.net/jython/?rev=3029&view=rev
Author: pedronis
Date: 2006-12-26 11:56:13 -0800 (Tue, 26 Dec 2006)
Log Message:
-----------
generator and checkers vs 22 and 23 of the conversion to new-style classes
status: how our own builtin-in
types hierarchy matches the corresponding CPython ones.
Some differences are benign: not having __getattribute__ in some places. Some
missing things in type.
Other aren't, especially after my dispatch changes, the missing __mod__ are in
this category.
__cmp__ vs __eq__ etc difference are an open question.
The problem with the type of __new__ is probably some missing expose_as .
This is still leaving out some important types/descriptors and things that are
jython specific
but will need conversion at some point too.
On a related note: indeed the types module is quite wrong at the moment.
Added Paths:
-----------
trunk/jython/Misc/checker22.py
trunk/jython/Misc/checker23.py
trunk/jython/Misc/make_checker.py
Added: trunk/jython/Misc/checker22.py
===================================================================
--- trunk/jython/Misc/checker22.py (rev 0)
+++ trunk/jython/Misc/checker22.py 2006-12-26 19:56:13 UTC (rev 3029)
@@ -0,0 +1,632 @@
+names = {0: 'object',
+ 1: 'type',
+ 2: 'unicode',
+ 3: 'dict',
+ 4: 'list',
+ 5: 'slice',
+ 6: 'super',
+ 7: 'staticmethod',
+ 8: 'float',
+ 10: 'file',
+ 12: 'long',
+ 13: 'tuple',
+ 14: 'str',
+ 15: 'property',
+ 16: 'int',
+ 17: 'xrange',
+ 18: 'file',
+ 19: 'complex',
+ 20: 'bool',
+ 21: 'classmethod',
+ 22: 'function',
+ 23: 'instance method',
+ 24: 'code',
+ 25: 'frame',
+ 26: 'traceback',
+ 27: 'builtin_function_or_method'}
+checks = [[0,
+ 1,
+ (),
+ {'__class__': 'd',
+ '__delattr__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__init__': 'm',
+ '__new__': 27,
+ '__reduce__': 'm',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ '__str__': 'm'}],
+ [1,
+ 1,
+ (0,),
+ {'__base__': 'd',
+ '__bases__': 'd',
+ '__basicsize__': 'd',
+ '__call__': 'm',
+ '__cmp__': 'm',
+ '__delattr__': 'm',
+ '__dict__': 'd',
+ '__dictoffset__': 'd',
+ '__doc__': 'd',
+ '__flags__': 'd',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__itemsize__': 'd',
+ '__module__': 'd',
+ '__mro__': 'd',
+ '__name__': 'd',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ '__subclasses__': 'm',
+ '__weakrefoffset__': 'd',
+ 'mro': 'm'}],
+ [2,
+ 1,
+ (0,),
+ {'__add__': 'm',
+ '__cmp__': 'm',
+ '__contains__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getslice__': 'm',
+ '__hash__': 'm',
+ '__len__': 'm',
+ '__mul__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__rmul__': 'm',
+ '__str__': 'm',
+ 'capitalize': 'm',
+ 'center': 'm',
+ 'count': 'm',
+ 'encode': 'm',
+ 'endswith': 'm',
+ 'expandtabs': 'm',
+ 'find': 'm',
+ 'index': 'm',
+ 'isalnum': 'm',
+ 'isalpha': 'm',
+ 'isdecimal': 'm',
+ 'isdigit': 'm',
+ 'islower': 'm',
+ 'isnumeric': 'm',
+ 'isspace': 'm',
+ 'istitle': 'm',
+ 'isupper': 'm',
+ 'join': 'm',
+ 'ljust': 'm',
+ 'lower': 'm',
+ 'lstrip': 'm',
+ 'replace': 'm',
+ 'rfind': 'm',
+ 'rindex': 'm',
+ 'rjust': 'm',
+ 'rstrip': 'm',
+ 'split': 'm',
+ 'splitlines': 'm',
+ 'startswith': 'm',
+ 'strip': 'm',
+ 'swapcase': 'm',
+ 'title': 'm',
+ 'translate': 'm',
+ 'upper': 'm',
+ 'zfill': 'm'}],
+ [3,
+ 1,
+ (0,),
+ {'__cmp__': 'm',
+ '__contains__': 'm',
+ '__delitem__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__ne__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__setitem__': 'm',
+ 'clear': 'm',
+ 'copy': 'm',
+ 'get': 'm',
+ 'has_key': 'm',
+ 'items': 'm',
+ 'iteritems': 'm',
+ 'iterkeys': 'm',
+ 'itervalues': 'm',
+ 'keys': 'm',
+ 'popitem': 'm',
+ 'setdefault': 'm',
+ 'update': 'm',
+ 'values': 'm'}],
+ [4,
+ 1,
+ (0,),
+ {'__add__': 'm',
+ '__contains__': 'm',
+ '__delitem__': 'm',
+ '__delslice__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getslice__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__iadd__': 'm',
+ '__imul__': 'm',
+ '__init__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__rmul__': 'm',
+ '__setitem__': 'm',
+ '__setslice__': 'm',
+ 'append': 'm',
+ 'count': 'm',
+ 'extend': 'm',
+ 'index': 'm',
+ 'insert': 'm',
+ 'pop': 'm',
+ 'remove': 'm',
+ 'reverse': 'm',
+ 'sort': 'm'}],
+ [5, 27, None, None],
+ [6,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__self__': 'd',
+ '__thisclass__': 'd'}],
+ [7,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 27}],
+ [8,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__cmp__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__int__': 'm',
+ '__long__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__neg__': 'm',
+ '__new__': 27,
+ '__nonzero__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__rpow__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm'}],
+ [10,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ 'close': 'm',
+ 'closed': 'd',
+ 'fileno': 'm',
+ 'flush': 'm',
+ 'isatty': 'm',
+ 'mode': 'd',
+ 'name': 'd',
+ 'read': 'm',
+ 'readinto': 'm',
+ 'readline': 'm',
+ 'readlines': 'm',
+ 'seek': 'm',
+ 'softspace': 'd',
+ 'tell': 'm',
+ 'truncate': 'm',
+ 'write': 'm',
+ 'writelines': 'm',
+ 'xreadlines': 'm'}],
+ [12,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__and__': 'm',
+ '__cmp__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__hex__': 'm',
+ '__int__': 'm',
+ '__invert__': 'm',
+ '__long__': 'm',
+ '__lshift__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__neg__': 'm',
+ '__new__': 27,
+ '__nonzero__': 'm',
+ '__oct__': 'm',
+ '__or__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rand__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rlshift__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__ror__': 'm',
+ '__rpow__': 'm',
+ '__rrshift__': 'm',
+ '__rshift__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__rxor__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm',
+ '__xor__': 'm'}],
+ [13,
+ 1,
+ (0,),
+ {'__add__': 'm',
+ '__contains__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getslice__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__rmul__': 'm'}],
+ [14,
+ 1,
+ (0,),
+ {'__add__': 'm',
+ '__contains__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getslice__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__rmul__': 'm',
+ '__str__': 'm',
+ 'capitalize': 'm',
+ 'center': 'm',
+ 'count': 'm',
+ 'decode': 'm',
+ 'encode': 'm',
+ 'endswith': 'm',
+ 'expandtabs': 'm',
+ 'find': 'm',
+ 'index': 'm',
+ 'isalnum': 'm',
+ 'isalpha': 'm',
+ 'isdigit': 'm',
+ 'islower': 'm',
+ 'isspace': 'm',
+ 'istitle': 'm',
+ 'isupper': 'm',
+ 'join': 'm',
+ 'ljust': 'm',
+ 'lower': 'm',
+ 'lstrip': 'm',
+ 'replace': 'm',
+ 'rfind': 'm',
+ 'rindex': 'm',
+ 'rjust': 'm',
+ 'rstrip': 'm',
+ 'split': 'm',
+ 'splitlines': 'm',
+ 'startswith': 'm',
+ 'strip': 'm',
+ 'swapcase': 'm',
+ 'title': 'm',
+ 'translate': 'm',
+ 'upper': 'm',
+ 'zfill': 'm'}],
+ [15,
+ 1,
+ (0,),
+ {'__delete__': 'm',
+ '__doc__': 'd',
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 27,
+ '__set__': 'm',
+ 'fdel': 'd',
+ 'fget': 'd',
+ 'fset': 'd'}],
+ [16,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__and__': 'm',
+ '__cmp__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__hex__': 'm',
+ '__int__': 'm',
+ '__invert__': 'm',
+ '__long__': 'm',
+ '__lshift__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__neg__': 'm',
+ '__new__': 27,
+ '__nonzero__': 'm',
+ '__oct__': 'm',
+ '__or__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rand__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rlshift__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__ror__': 'm',
+ '__rpow__': 'm',
+ '__rrshift__': 'm',
+ '__rshift__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__rxor__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm',
+ '__xor__': 'm'}],
+ [17, 27, None, None],
+ [10,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__new__': 27,
+ '__repr__': 'm',
+ 'close': 'm',
+ 'closed': 'd',
+ 'fileno': 'm',
+ 'flush': 'm',
+ 'isatty': 'm',
+ 'mode': 'd',
+ 'name': 'd',
+ 'read': 'm',
+ 'readinto': 'm',
+ 'readline': 'm',
+ 'readlines': 'm',
+ 'seek': 'm',
+ 'softspace': 'd',
+ 'tell': 'm',
+ 'truncate': 'm',
+ 'write': 'm',
+ 'writelines': 'm',
+ 'xreadlines': 'm'}],
+ [19,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__int__': 'm',
+ '__le__': 'm',
+ '__long__': 'm',
+ '__lt__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__neg__': 'm',
+ '__new__': 27,
+ '__nonzero__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__rpow__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm',
+ 'conjugate': 'm',
+ 'imag': 'd',
+ 'real': 'd'}],
+ [20, 27, None, None],
+ [21,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 27}],
+ [22,
+ 1,
+ (0,),
+ {'__call__': 'm',
+ '__delattr__': 'm',
+ '__dict__': 'd',
+ '__doc__': 'd',
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__name__': 'd',
+ '__new__': 27,
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ 'func_closure': 'd',
+ 'func_code': 'd',
+ 'func_defaults': 'd',
+ 'func_dict': 'd',
+ 'func_doc': 'd',
+ 'func_globals': 'd',
+ 'func_name': 'd'}],
+ [23,
+ 1,
+ (0,),
+ {'__call__': 'm',
+ '__cmp__': 'm',
+ '__delattr__': 'm',
+ '__doc__': '-',
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ 'im_class': 'd',
+ 'im_func': 'd',
+ 'im_self': 'd'}],
+ [24,
+ 1,
+ (0,),
+ {'__cmp__': 'm',
+ '__doc__': '-',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__repr__': 'm',
+ 'co_argcount': 'd',
+ 'co_cellvars': 'd',
+ 'co_code': 'd',
+ 'co_consts': 'd',
+ 'co_filename': 'd',
+ 'co_firstlineno': 'd',
+ 'co_flags': 'd',
+ 'co_freevars': 'd',
+ 'co_lnotab': 'd',
+ 'co_name': 'd',
+ 'co_names': 'd',
+ 'co_nlocals': 'd',
+ 'co_stacksize': 'd',
+ 'co_varnames': 'd'}],
+ [25,
+ 1,
+ (0,),
+ {'__delattr__': 'm',
+ '__doc__': '-',
+ '__getattribute__': 'm',
+ '__setattr__': 'm',
+ 'f_back': 'd',
+ 'f_builtins': 'd',
+ 'f_code': 'd',
+ 'f_exc_traceback': 'd',
+ 'f_exc_type': 'd',
+ 'f_exc_value': 'd',
+ 'f_globals': 'd',
+ 'f_lasti': 'd',
+ 'f_lineno': 'd',
+ 'f_locals': 'd',
+ 'f_restricted': 'd',
+ 'f_trace': 'd'}],
+ [26, 1, (0,), {'__doc__': '-'}],
+ [27,
+ 1,
+ (0,),
+ {'__call__': 'm',
+ '__cmp__': 'm',
+ '__doc__': 'd',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__name__': 'd',
+ '__repr__': 'm',
+ '__self__': 'd'}]]
+print 'comparing with information from 2.2.3+'
+import make_checker
+make_checker.do_check(names, checks)
Property changes on: trunk/jython/Misc/checker22.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/jython/Misc/checker23.py
===================================================================
--- trunk/jython/Misc/checker23.py (rev 0)
+++ trunk/jython/Misc/checker23.py 2006-12-26 19:56:13 UTC (rev 3029)
@@ -0,0 +1,720 @@
+names = {0: 'object',
+ 1: 'type',
+ 2: 'unicode',
+ 3: 'dict',
+ 4: 'list',
+ 5: 'slice',
+ 6: 'super',
+ 7: 'staticmethod',
+ 8: 'float',
+ 9: 'enumerate',
+ 10: 'file',
+ 11: 'basestring',
+ 12: 'long',
+ 13: 'tuple',
+ 14: 'str',
+ 15: 'property',
+ 16: 'int',
+ 17: 'xrange',
+ 18: 'file',
+ 19: 'complex',
+ 20: 'bool',
+ 21: 'classmethod',
+ 22: 'function',
+ 23: 'instancemethod',
+ 24: 'code',
+ 25: 'frame',
+ 26: 'traceback',
+ 27: 'type'}
+checks = [[0,
+ 1,
+ (),
+ {'__class__': 'd',
+ '__delattr__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__init__': 'm',
+ '__new__': 'n',
+ '__reduce__': 'm',
+ '__reduce_ex__': 'm',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ '__str__': 'm'}],
+ [1,
+ 1,
+ (0,),
+ {'__base__': 'd',
+ '__bases__': 'd',
+ '__basicsize__': 'd',
+ '__call__': 'm',
+ '__cmp__': 'm',
+ '__delattr__': 'm',
+ '__dict__': 'd',
+ '__dictoffset__': 'd',
+ '__doc__': 'd',
+ '__flags__': 'd',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__itemsize__': 'd',
+ '__module__': 'd',
+ '__mro__': 'd',
+ '__name__': 'd',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ '__subclasses__': 'm',
+ '__weakrefoffset__': 'd',
+ 'mro': 'm'}],
+ [2,
+ 1,
+ (11,),
+ {'__add__': 'm',
+ '__cmp__': 'm',
+ '__contains__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getnewargs__': 'm',
+ '__getslice__': 'm',
+ '__hash__': 'm',
+ '__len__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__str__': 'm',
+ 'capitalize': 'm',
+ 'center': 'm',
+ 'count': 'm',
+ 'encode': 'm',
+ 'endswith': 'm',
+ 'expandtabs': 'm',
+ 'find': 'm',
+ 'index': 'm',
+ 'isalnum': 'm',
+ 'isalpha': 'm',
+ 'isdecimal': 'm',
+ 'isdigit': 'm',
+ 'islower': 'm',
+ 'isnumeric': 'm',
+ 'isspace': 'm',
+ 'istitle': 'm',
+ 'isupper': 'm',
+ 'join': 'm',
+ 'ljust': 'm',
+ 'lower': 'm',
+ 'lstrip': 'm',
+ 'replace': 'm',
+ 'rfind': 'm',
+ 'rindex': 'm',
+ 'rjust': 'm',
+ 'rstrip': 'm',
+ 'split': 'm',
+ 'splitlines': 'm',
+ 'startswith': 'm',
+ 'strip': 'm',
+ 'swapcase': 'm',
+ 'title': 'm',
+ 'translate': 'm',
+ 'upper': 'm',
+ 'zfill': 'm'}],
+ [3,
+ 1,
+ (0,),
+ {'__cmp__': 'm',
+ '__contains__': 'm',
+ '__delitem__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__ne__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setitem__': 'm',
+ 'clear': 'm',
+ 'copy': 'm',
+ 'fromkeys': 21,
+ 'get': 'm',
+ 'has_key': 'm',
+ 'items': 'm',
+ 'iteritems': 'm',
+ 'iterkeys': 'm',
+ 'itervalues': 'm',
+ 'keys': 'm',
+ 'pop': 'm',
+ 'popitem': 'm',
+ 'setdefault': 'm',
+ 'update': 'm',
+ 'values': 'm'}],
+ [4,
+ 1,
+ (0,),
+ {'__add__': 'm',
+ '__contains__': 'm',
+ '__delitem__': 'm',
+ '__delslice__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getslice__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__iadd__': 'm',
+ '__imul__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__rmul__': 'm',
+ '__setitem__': 'm',
+ '__setslice__': 'm',
+ 'append': 'm',
+ 'count': 'm',
+ 'extend': 'm',
+ 'index': 'm',
+ 'insert': 'm',
+ 'pop': 'm',
+ 'remove': 'm',
+ 'reverse': 'm',
+ 'sort': 'm'}],
+ [5,
+ 1,
+ (0,),
+ {'__cmp__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ 'indices': 'm',
+ 'start': 'd',
+ 'step': 'd',
+ 'stop': 'd'}],
+ [6,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__self__': 'd',
+ '__self_class__': 'd',
+ '__thisclass__': 'd'}],
+ [7,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 'n'}],
+ [8,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__cmp__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__getattribute__': 'm',
+ '__getnewargs__': 'm',
+ '__hash__': 'm',
+ '__int__': 'm',
+ '__long__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__neg__': 'm',
+ '__new__': 'n',
+ '__nonzero__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__rpow__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm'}],
+ [9,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__getattribute__': 'm',
+ '__iter__': 'm',
+ '__new__': 'n',
+ 'next': 'm'}],
+ [10,
+ 1,
+ (0,),
+ {'__delattr__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ 'close': 'm',
+ 'closed': 'd',
+ 'encoding': 'd',
+ 'fileno': 'm',
+ 'flush': 'm',
+ 'isatty': 'm',
+ 'mode': 'd',
+ 'name': 'd',
+ 'newlines': 'd',
+ 'next': 'm',
+ 'read': 'm',
+ 'readinto': 'm',
+ 'readline': 'm',
+ 'readlines': 'm',
+ 'seek': 'm',
+ 'softspace': 'd',
+ 'tell': 'm',
+ 'truncate': 'm',
+ 'write': 'm',
+ 'writelines': 'm',
+ 'xreadlines': 'm'}],
+ [11, 1, (0,), {'__new__': 'n', '__doc__': 14}],
+ [12,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__and__': 'm',
+ '__cmp__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__getattribute__': 'm',
+ '__getnewargs__': 'm',
+ '__hash__': 'm',
+ '__hex__': 'm',
+ '__int__': 'm',
+ '__invert__': 'm',
+ '__long__': 'm',
+ '__lshift__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__neg__': 'm',
+ '__new__': 'n',
+ '__nonzero__': 'm',
+ '__oct__': 'm',
+ '__or__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rand__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rlshift__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__ror__': 'm',
+ '__rpow__': 'm',
+ '__rrshift__': 'm',
+ '__rshift__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__rxor__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm',
+ '__xor__': 'm'}],
+ [13,
+ 1,
+ (0,),
+ {'__add__': 'm',
+ '__contains__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getnewargs__': 'm',
+ '__getslice__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__iter__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__rmul__': 'm'}],
+ [14,
+ 1,
+ (11,),
+ {'__add__': 'm',
+ '__contains__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__getnewargs__': 'm',
+ '__getslice__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__le__': 'm',
+ '__len__': 'm',
+ '__lt__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__str__': 'm',
+ 'capitalize': 'm',
+ 'center': 'm',
+ 'count': 'm',
+ 'decode': 'm',
+ 'encode': 'm',
+ 'endswith': 'm',
+ 'expandtabs': 'm',
+ 'find': 'm',
+ 'index': 'm',
+ 'isalnum': 'm',
+ 'isalpha': 'm',
+ 'isdigit': 'm',
+ 'islower': 'm',
+ 'isspace': 'm',
+ 'istitle': 'm',
+ 'isupper': 'm',
+ 'join': 'm',
+ 'ljust': 'm',
+ 'lower': 'm',
+ 'lstrip': 'm',
+ 'replace': 'm',
+ 'rfind': 'm',
+ 'rindex': 'm',
+ 'rjust': 'm',
+ 'rstrip': 'm',
+ 'split': 'm',
+ 'splitlines': 'm',
+ 'startswith': 'm',
+ 'strip': 'm',
+ 'swapcase': 'm',
+ 'title': 'm',
+ 'translate': 'm',
+ 'upper': 'm',
+ 'zfill': 'm'}],
+ [15,
+ 1,
+ (0,),
+ {'__delete__': 'm',
+ '__doc__': 'd',
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 'n',
+ '__set__': 'm',
+ 'fdel': 'd',
+ 'fget': 'd',
+ 'fset': 'd'}],
+ [16,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__and__': 'm',
+ '__cmp__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__getattribute__': 'm',
+ '__getnewargs__': 'm',
+ '__hash__': 'm',
+ '__hex__': 'm',
+ '__int__': 'm',
+ '__invert__': 'm',
+ '__long__': 'm',
+ '__lshift__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__neg__': 'm',
+ '__new__': 'n',
+ '__nonzero__': 'm',
+ '__oct__': 'm',
+ '__or__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rand__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rlshift__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__ror__': 'm',
+ '__rpow__': 'm',
+ '__rrshift__': 'm',
+ '__rshift__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__rxor__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm',
+ '__xor__': 'm'}],
+ [17,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__getattribute__': 'm',
+ '__getitem__': 'm',
+ '__iter__': 'm',
+ '__len__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm'}],
+ [10,
+ 1,
+ (0,),
+ {'__delattr__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__iter__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ 'close': 'm',
+ 'closed': 'd',
+ 'encoding': 'd',
+ 'fileno': 'm',
+ 'flush': 'm',
+ 'isatty': 'm',
+ 'mode': 'd',
+ 'name': 'd',
+ 'newlines': 'd',
+ 'next': 'm',
+ 'read': 'm',
+ 'readinto': 'm',
+ 'readline': 'm',
+ 'readlines': 'm',
+ 'seek': 'm',
+ 'softspace': 'd',
+ 'tell': 'm',
+ 'truncate': 'm',
+ 'write': 'm',
+ 'writelines': 'm',
+ 'xreadlines': 'm'}],
+ [19,
+ 1,
+ (0,),
+ {'__abs__': 'm',
+ '__add__': 'm',
+ '__coerce__': 'm',
+ '__div__': 'm',
+ '__divmod__': 'm',
+ '__doc__': 14,
+ '__eq__': 'm',
+ '__float__': 'm',
+ '__floordiv__': 'm',
+ '__ge__': 'm',
+ '__getattribute__': 'm',
+ '__getnewargs__': 'm',
+ '__gt__': 'm',
+ '__hash__': 'm',
+ '__int__': 'm',
+ '__le__': 'm',
+ '__long__': 'm',
+ '__lt__': 'm',
+ '__mod__': 'm',
+ '__mul__': 'm',
+ '__ne__': 'm',
+ '__neg__': 'm',
+ '__new__': 'n',
+ '__nonzero__': 'm',
+ '__pos__': 'm',
+ '__pow__': 'm',
+ '__radd__': 'm',
+ '__rdiv__': 'm',
+ '__rdivmod__': 'm',
+ '__repr__': 'm',
+ '__rfloordiv__': 'm',
+ '__rmod__': 'm',
+ '__rmul__': 'm',
+ '__rpow__': 'm',
+ '__rsub__': 'm',
+ '__rtruediv__': 'm',
+ '__str__': 'm',
+ '__sub__': 'm',
+ '__truediv__': 'm',
+ 'conjugate': 'm',
+ 'imag': 'd',
+ 'real': 'd'}],
+ [20,
+ 1,
+ (16,),
+ {'__and__': 'm',
+ '__doc__': 14,
+ '__new__': 'n',
+ '__or__': 'm',
+ '__rand__': 'm',
+ '__repr__': 'm',
+ '__ror__': 'm',
+ '__rxor__': 'm',
+ '__str__': 'm',
+ '__xor__': 'm'}],
+ [21,
+ 1,
+ (0,),
+ {'__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__init__': 'm',
+ '__new__': 'n'}],
+ [22,
+ 1,
+ (0,),
+ {'__call__': 'm',
+ '__delattr__': 'm',
+ '__dict__': 'd',
+ '__doc__': 'd',
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__module__': 'd',
+ '__name__': 'd',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ 'func_closure': 'd',
+ 'func_code': 'd',
+ 'func_defaults': 'd',
+ 'func_dict': 'd',
+ 'func_doc': 'd',
+ 'func_globals': 'd',
+ 'func_name': 'd'}],
+ [23,
+ 1,
+ (0,),
+ {'__call__': 'm',
+ '__cmp__': 'm',
+ '__delattr__': 'm',
+ '__doc__': 14,
+ '__get__': 'm',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ 'im_class': 'd',
+ 'im_func': 'd',
+ 'im_self': 'd'}],
+ [24,
+ 1,
+ (0,),
+ {'__cmp__': 'm',
+ '__doc__': 14,
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__new__': 'n',
+ '__repr__': 'm',
+ 'co_argcount': 'd',
+ 'co_cellvars': 'd',
+ 'co_code': 'd',
+ 'co_consts': 'd',
+ 'co_filename': 'd',
+ 'co_firstlineno': 'd',
+ 'co_flags': 'd',
+ 'co_freevars': 'd',
+ 'co_lnotab': 'd',
+ 'co_name': 'd',
+ 'co_names': 'd',
+ 'co_nlocals': 'd',
+ 'co_stacksize': 'd',
+ 'co_varnames': 'd'}],
+ [25,
+ 1,
+ (0,),
+ {'__delattr__': 'm',
+ '__doc__': '-',
+ '__getattribute__': 'm',
+ '__setattr__': 'm',
+ 'f_back': 'd',
+ 'f_builtins': 'd',
+ 'f_code': 'd',
+ 'f_exc_traceback': 'd',
+ 'f_exc_type': 'd',
+ 'f_exc_value': 'd',
+ 'f_globals': 'd',
+ 'f_lasti': 'd',
+ 'f_lineno': 'd',
+ 'f_locals': 'd',
+ 'f_restricted': 'd',
+ 'f_trace': 'd'}],
+ [26, 1, (0,), {'__doc__': '-'}],
+ [1,
+ 1,
+ (0,),
+ {'__base__': 'd',
+ '__bases__': 'd',
+ '__basicsize__': 'd',
+ '__call__': 'm',
+ '__cmp__': 'm',
+ '__delattr__': 'm',
+ '__dict__': 'd',
+ '__dictoffset__': 'd',
+ '__doc__': 'd',
+ '__flags__': 'd',
+ '__getattribute__': 'm',
+ '__hash__': 'm',
+ '__itemsize__': 'd',
+ '__module__': 'd',
+ '__mro__': 'd',
+ '__name__': 'd',
+ '__new__': 'n',
+ '__repr__': 'm',
+ '__setattr__': 'm',
+ '__subclasses__': 'm',
+ '__weakrefoffset__': 'd',
+ 'mro': 'm'}]]
+print 'comparing with information from 2.3.5'
+import make_checker
+make_checker.do_check(names, checks)
Property changes on: trunk/jython/Misc/checker23.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/jython/Misc/make_checker.py
===================================================================
--- trunk/jython/Misc/make_checker.py (rev 0)
+++ trunk/jython/Misc/make_checker.py 2006-12-26 19:56:13 UTC (rev 3029)
@@ -0,0 +1,188 @@
+import __builtin__
+
+import sys
+import __builtin__
+
+opt = lambda n: getattr(__builtin__, n, None)
+
+def f(): pass
+try:
+ raise Exception
+except:
+ _, _, tb = sys.exc_info()
+
+class C:
+ f = f
+
+m = C.f
+
+types_list = [
+object,
+type,
+unicode,
+dict,
+list,
+slice,
+super,
+staticmethod,
+float,
+opt('enumerate'),
+open,
+opt('basestring'),
+long,
+tuple,
+str,
+property,
+int,
+xrange,
+file,
+complex,
+opt('bool'),
+classmethod,
+#buffer,
+# +
+type(f),
+type(m),
+type(f.func_code),
+type(sys._getframe()),
+type(tb),
+type(slice),
+]
+
+del f, tb
+if 0:
+ for n, x in __builtin__.__dict__.items():
+ if isinstance(x, type):
+ if x not in types:
+ print "%s," % n
+
+i = 0
+types = {}
+for t in types_list:
+ if t is not None:
+ types.setdefault(t, i)
+ i += 1
+
+extra = {
+ type(dict.__dict__.get('fromkeys')): types[classmethod], # xxx hack
+ type(list.__dict__['append']): 'm',
+ type(int.__dict__['__add__']): 'm',
+ type(int.__dict__['__new__']): 'n',
+ type(object.__dict__['__class__']): 'd',
+ type(super.__dict__['__thisclass__']): 'd',
+ type(None): '-',
+}
+
+def which(t):
+ try:
+ return types[t]
+ except KeyError:
+ return extra[t]
+
+def do_check(names, checks):
+ def swhich(t):
+ try:
+ return which(t)
+ except KeyError:
+ return "%s?" % t.__name__
+ def n(fnd):
+ if isinstance(fnd, tuple):
+ return tuple(map(n, fnd))
+ r = names.get(fnd, fnd)
+ if isinstance(r, int):
+ return "%s?" % types_list[fnd].__name__
+ return r
+ for check in checks:
+ index, expected_type, expected_bases, expected_dict = check
+ t = types_list[index]
+ print names[index], t
+ if t is None:
+ print " Missing!"
+ continue
+ which_type = swhich(type(t))
+ err = 0
+ if which_type != expected_type:
+ print " type %s isn't %s" % ( type(t).__name__, n(expected_type))
+ err += 1
+ elif expected_bases:
+ which_bases = tuple(map(swhich, t.__bases__))
+ if which_bases != expected_bases:
+ print " bases %s aren't %s" % (n(which_bases),
+ n(expected_bases))
+ err += 1
+ d = t.__dict__
+ miss = []
+ extra = []
+ for name in d.keys():
+ if name not in expected_dict:
+ extra.append(name)
+ if extra:
+ print " extra %s" % extra
+ err += len(extra)
+ for name, expected in expected_dict.items():
+ if name not in d:
+ miss.append(name)
+ else:
+ which_type = swhich(type(d[name]))
+ if which_type != expected:
+ print "%r type %s isn't %s" % (name, n(which_type),
+ n(expected))
+ err += 1
+ if miss:
+ print " missing %s" % miss
+ err += len(miss)
+
+ if not err:
+ print ' OK'
+ else:
+ print ' %d problems' % err
+
+
+if __name__ == '__main__':
+ names = {}
+ checks = []
+ i = -1
+ for t in types_list:
+ i += 1
+ if t is None:
+ continue
+ names[i] = t.__name__
+ check = []
+ checks.append(check)
+ check.append(which(t)) # index
+ assert type(t) in types, t
+ check.append(which(type(t)))
+ if not hasattr(t, '__bases__'):
+ check.extend([None, None])
+ continue
+ bases = []
+ for b in t.__bases__:
+ assert b in types
+ bases.append(which(b))
+ check.append(tuple(bases))
+ membs = {}
+ for n,x in t.__dict__.items():
+ membs[n] = which(type(x))
+ check.append(membs)
+
+
+ # sanity-check
+ do_check(names, checks)
+
+ ver = sys.version.split()[0]
+ simple_ver = ver[:3].replace('.', '')
+
+ import pprint
+ f = open('checker%s.py' % simple_ver, 'w')
+ print >>f, "names = ",
+ pprint.pprint(names, stream=f)
+ print >>f, "checks = ",
+ pprint.pprint(checks, stream=f)
+ print >>f, "print 'comparing with information from %s'" % ver
+ print >>f, "import make_checker"
+ print >>f, "make_checker.do_check(names, checks)"
+ f.close()
+
+
+
+
Property changes on: trunk/jython/Misc/make_checker.py
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 22, 2006
From: kzuberi@xxxxxxxxxxxxxxxxxxxxx
Revision: 3028
http://svn.sourceforge.net/jython/?rev=3028&view=rev
Author: kzuberi
Date: 2006-12-21 23:19:04 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
remove another java1.4-ism, trunk should now compile/run on java 1.3
Modified Paths:
--------------
trunk/jython/Lib/test/javatests/TestSupport.java
Modified: trunk/jython/Lib/test/javatests/TestSupport.java
===================================================================
--- trunk/jython/Lib/test/javatests/TestSupport.java 2006-12-22 07:08:51 UTC
(rev 3027)
+++ trunk/jython/Lib/test/javatests/TestSupport.java 2006-12-22 07:19:04 UTC
(rev 3028)
@@ -16,6 +16,7 @@
super(message);
}
+ /* not until java 1.4
public AssertionError(String message, Throwable cause) {
super(message, cause);
}
@@ -23,6 +24,7 @@
public AssertionError(Throwable cause) {
super(cause);
}
+ */
}
public static void assertThat(boolean test, String message) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 22, 2006
From: kzuberi@xxxxxxxxxxxxxxxxxxxxx
Revision: 3027
http://svn.sourceforge.net/jython/?rev=3027&view=rev
Author: kzuberi
Date: 2006-12-21 23:08:51 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
jython 2.2 is still supporting java versions older than
1.4 AFAIK, so remove use of String.replaceAll()
Modified Paths:
--------------
trunk/jython/src/org/python/core/PySystemState.java
Modified: trunk/jython/src/org/python/core/PySystemState.java
===================================================================
--- trunk/jython/src/org/python/core/PySystemState.java 2006-12-21 23:34:53 UTC
(rev 3026)
+++ trunk/jython/src/org/python/core/PySystemState.java 2006-12-22 07:08:51 UTC
(rev 3027)
@@ -673,8 +673,14 @@
if (urlString.startsWith(JAR_URL_PREFIX) && jarSeparatorIndex > 0)
{
jarFileName = urlString.substring(JAR_URL_PREFIX.length(),
jarSeparatorIndex);
// handle directories containing blanks
- if (jarFileName.indexOf(URL_BLANK_REPLACEMENT) >= 0) {
- jarFileName =
jarFileName.replaceAll(URL_BLANK_REPLACEMENT, " ");
+ // we can't use String.replaceAll before java 1.4, so instead
of the obvious:
+ // jarFileName =
jarFileName.replaceAll(URL_BLANK_REPLACEMENT, " ");
+ // apply repeated substitutions, which should be safe in this
case
+ int URL_BLANK_LOCATION =
jarFileName.indexOf(URL_BLANK_REPLACEMENT);
+ while (URL_BLANK_LOCATION >= 0) {
+ jarFileName = jarFileName.substring(0, URL_BLANK_LOCATION)
+ " " +
+ jarFileName.substring(URL_BLANK_LOCATION +
URL_BLANK_REPLACEMENT.length());
+ URL_BLANK_LOCATION =
jarFileName.indexOf(URL_BLANK_REPLACEMENT);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 21, 2006
From: pedronis@xxxxxxxxxxxxxxxxxxxxx
Revision: 3026
http://svn.sourceforge.net/jython/?rev=3026&view=rev
Author: pedronis
Date: 2006-12-21 15:34:53 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
move the check class_to_type cache check as late as possible, to cope
with reentrance with the same c.
The original check is just an optimisation now.
See
http://sourceforge.net/mailarchive/forum.php?thread_id=31282636&forum_id=5587
and subsequent messages.
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 2006-12-19 23:14:36 UTC
(rev 3025)
+++ trunk/jython/src/org/python/core/PyType.java 2006-12-21 23:34:53 UTC
(rev 3026)
@@ -1312,9 +1312,12 @@
if (exposed_methods == null)
exposed_methods = EMPTY;
}
- PyType newtype = c == PyType.class ? new PyType(true) : new PyType();
- class_to_type.put(c, newtype);
- fillFromClass(newtype, name, c, base, newstyle, setup,
exposed_methods);
+ PyType newtype = (PyType)class_to_type.get(c);
+ if (newtype == null) {
+ newtype = c == PyType.class ? new PyType(true) : new PyType();
+ class_to_type.put(c, newtype);
+ fillFromClass(newtype, name, c, base, newstyle, setup,
exposed_methods);
+ }
return newtype;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 19, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3025
http://svn.sourceforge.net/jython/?rev=3025&view=rev
Author: otmarhumbel
Date: 2006-12-19 15:14:36 -0800 (Tue, 19 Dec 2006)
Log Message:
-----------
fixes bug 1565629
Modified Paths:
--------------
trunk/installer/src/java/org/python/util/install/DirectorySelectionPage.java
Modified:
trunk/installer/src/java/org/python/util/install/DirectorySelectionPage.java
===================================================================
---
trunk/installer/src/java/org/python/util/install/DirectorySelectionPage.java
2006-12-19 22:32:22 UTC (rev 3024)
+++
trunk/installer/src/java/org/python/util/install/DirectorySelectionPage.java
2006-12-19 23:14:36 UTC (rev 3025)
@@ -107,31 +107,45 @@
}
private File getDefaultDirectory() {
- // 1st try: user.home
String directory = "";
- File parentDirectory = null;
- directory = System.getProperty("user.home", "");
- if (directory.length() > 0) {
- parentDirectory = new File(directory);
- if (parentDirectory.exists() && parentDirectory.isDirectory()) {
- return makeJythonSubDirectory(parentDirectory);
+ File defaultDirectory = null;
+ // 1st try (on windows): root
+ if (Installation.isWindows()) {
+ directory = System.getProperty("java.home", "C:");
+ if (directory.length() > 2) {
+ directory = directory.substring(0, 2);
}
+ defaultDirectory = makeJythonSubDirectory(directory);
}
- // 2nd try: user.dir
- directory = System.getProperty("user.dir", "");
- if (directory.length() > 0) {
- parentDirectory = new File(directory);
- if (parentDirectory.exists() && parentDirectory.isDirectory()) {
- return makeJythonSubDirectory(parentDirectory);
+ // 2st try: user.home
+ if (defaultDirectory == null) {
+ directory = System.getProperty("user.home", "");
+ if (directory.length() > 0) {
+ defaultDirectory = makeJythonSubDirectory(directory);
}
}
- // 3rd try: current directory
- return makeJythonSubDirectory(new File(new File(new
File("dummy").getAbsolutePath()).getParent()));
+ // 3rd try: user.dir
+ if (defaultDirectory == null) {
+ directory = System.getProperty("user.dir", "");
+ if (directory.length() > 0) {
+ defaultDirectory = makeJythonSubDirectory(directory);
+ }
+ }
+ // 4th try: current directory
+ if (defaultDirectory == null) {
+ defaultDirectory = makeJythonSubDirectory(new File(new
File("dummy").getAbsolutePath()).getParent());
+ }
+ return defaultDirectory;
}
- private File makeJythonSubDirectory(File parentDirectory) {
- String jythonSubDirectoryName = "jython" + _jarInfo.getVersion();
- return new File(parentDirectory, jythonSubDirectoryName);
+ private File makeJythonSubDirectory(String directory) {
+ File defaultDirectory = null;
+ File parentDirectory = new File(directory);
+ if (parentDirectory.exists() && parentDirectory.isDirectory()) {
+ String jythonSubDirectoryName = "jython" + _jarInfo.getVersion();
+ defaultDirectory = new File(parentDirectory,
jythonSubDirectoryName);
+ }
+ return defaultDirectory;
}
private class BrowseButtonListener implements ActionListener {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 19, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3024
http://svn.sourceforge.net/jython/?rev=3024&view=rev
Author: otmarhumbel
Date: 2006-12-19 14:32:22 -0800 (Tue, 19 Dec 2006)
Log Message:
-----------
the resulting .jar for the installation is now named
jython_installer_<version>.jar
Modified Paths:
--------------
trunk/jython/build.xml
Modified: trunk/jython/build.xml
===================================================================
--- trunk/jython/build.xml 2006-12-19 21:35:09 UTC (rev 3023)
+++ trunk/jython/build.xml 2006-12-19 22:32:22 UTC (rev 3024)
@@ -20,7 +20,7 @@
- call target 'full-build'
This build will create a working directory named full_build_${svn.tag} at the
same
level as your local directories bugtests, jython, sandbox and installer.
-It will contain a big jython_${svn.tag}.jar file suitable for installation.
+It will contain a big jython_installer_${svn.tag}.jar file suitable for
installation.
Please be aware:
To build older releases, it may be necessary to use an older build.xml, too
(with the corresponding tag).
@@ -654,7 +654,7 @@
<fileset dir="${install.src.dir}" includes="**/*.png"
excludes="bin/**" />
</copy>
<echo>building installer .jar file</echo>
- <jar destfile="${work.dir}/jython_${svn.revision}.jar"
basedir="${dist.dir}" update="true">
+ <jar destfile="${work.dir}/jython_installer_${svn.revision}.jar"
basedir="${dist.dir}" update="true">
<manifest>
<attribute name="Main-Class"
value="org.python.util.install.Installation" />
<attribute name="Built-By" value="${user.name}" />
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 19, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3023
http://svn.sourceforge.net/jython/?rev=3023&view=rev
Author: otmarhumbel
Date: 2006-12-19 13:35:09 -0800 (Tue, 19 Dec 2006)
Log Message:
-----------
added jython.jar to .svnignore
Property Changed:
----------------
trunk/bugtests/test386jar/
Property changes on: trunk/bugtests/test386jar
___________________________________________________________________
Name: svn:ignore
+
jython.jar
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 14, 2006
From: kzuberi@xxxxxxxxxxxxxxxxxxxxx
Revision: 3022
http://svn.sourceforge.net/jython/?rev=3022&view=rev
Author: kzuberi
Date: 2006-12-13 21:27:54 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Henrik Eriksson's patch 1612711 for bug 1604265,
adds iterkeys, itervalues, iteritems to PyStringMap
Modified Paths:
--------------
trunk/jython/src/org/python/core/PyStringMap.java
Modified: trunk/jython/src/org/python/core/PyStringMap.java
===================================================================
--- trunk/jython/src/org/python/core/PyStringMap.java 2006-12-12 16:55:20 UTC
(rev 3021)
+++ trunk/jython/src/org/python/core/PyStringMap.java 2006-12-14 05:27:54 UTC
(rev 3022)
@@ -543,17 +543,48 @@
}
return l;
}
+ /**
+ * return an iterator over (key, value) pairs
+ */
+ public synchronized PyObject iteritems() {
+ return new PyStringMapIter(keys, values, PyStringMapIter.ITEMS);
+ }
+
+ /**
+ * return an iterator over the keys
+ */
+ public synchronized PyObject iterkeys() {
+ return new PyStringMapIter(keys, values, PyStringMapIter.KEYS);
+ }
+
+ /**
+ * return an iterator over the values
+ */
+ public synchronized PyObject itervalues() {
+ return new PyStringMapIter(keys, values, PyStringMapIter.VALUES);
+ }
}
+/* extended, based on PyDictionaryIter */
class PyStringMapIter extends PyIterator {
String[] keyTable;
PyObject[] valTable;
private int idx;
+ private int type;
+ public static final int KEYS = 0;
+ public static final int VALUES = 1;
+ public static final int ITEMS = 2;
+
public PyStringMapIter(String[] keys, PyObject[] values) {
+ this(keys, values, KEYS);
+ }
+
+ public PyStringMapIter(String[] keys, PyObject[] values, int type) {
this.keyTable = keys;
this.valTable = values;
this.idx = 0;
+ this.type=type;
}
public PyObject __iternext__() {
@@ -561,14 +592,23 @@
for (; idx < n; idx++) {
String key = keyTable[idx];
- if (key == null || key == "<deleted key>" || valTable[idx] == null)
+ PyObject val = valTable[idx];
+ if (key == null || key == "<deleted key>" || val == null)
continue;
idx++;
- return Py.newString(key);
+
+ switch(type) {
+ case VALUES:
+ return val;
+ case ITEMS:
+ return new PyTuple(new PyObject[] { Py.newString(key),
+ val });
+ default: // KEYS
+ return Py.newString(key);
+ }
}
return null;
}
-
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 12, 2006
From: otmarhumbel@xxxxxxxxxxxxxxxxxxxxx
Revision: 3021
http://svn.sourceforge.net/jython/?rev=3021&view=rev
Author: otmarhumbel
Date: 2006-12-12 08:55:20 -0800 (Tue, 12 Dec 2006)
Log Message:
-----------
make sure to return a compiled info if a precompiled entry is available
Modified Paths:
--------------
trunk/jython/src/org/python/core/ZipFileImporter.java
Modified: trunk/jython/src/org/python/core/ZipFileImporter.java
===================================================================
--- trunk/jython/src/org/python/core/ZipFileImporter.java 2006-12-12
04:39:08 UTC (rev 3020)
+++ trunk/jython/src/org/python/core/ZipFileImporter.java 2006-12-12
16:55:20 UTC (rev 3021)
@@ -122,7 +122,9 @@
info = new ZipModuleInfo(zipArchive, compiledEntry, true);
}
}
- info = new ZipModuleInfo(zipArchive, sourceEntry, false);
+ if (info == null) {
+ info = new ZipModuleInfo(zipArchive, sourceEntry, false);
+ }
}
if (pkg && info != null) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 12, 2006
From: kzuberi@xxxxxxxxxxxxxxxxxxxxx
Revision: 3020
http://svn.sourceforge.net/jython/?rev=3020&view=rev
Author: kzuberi
Date: 2006-12-11 20:39:08 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
off by on in bugtest driver arg handling
Modified Paths:
--------------
trunk/bugtests/driver.py
Modified: trunk/bugtests/driver.py
===================================================================
--- trunk/bugtests/driver.py 2006-12-10 06:36:06 UTC (rev 3019)
+++ trunk/bugtests/driver.py 2006-12-12 04:39:08 UTC (rev 3020)
@@ -51,8 +51,8 @@
if warnings: print "LOUD warnings"
sys.path[:0] = ['classes']
- if len(args) > 1:
- tests = [int(test) for test in args[1].split(',')]
+ if len(args) > 0:
+ tests = [int(test) for test in args[0].split(',')]
else:
testfiles = glob.glob('test???.py')
testfiles.sort()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Date: December 10, 2006
From: cgroves@xxxxxxxxxxxxxxxxxxxxx
Revision: 3019
http://svn.sourceforge.net/jython/?rev=3019&view=rev
Author: cgroves
Date: 2006-12-09 22:36:06 -0800 (Sat, 09 Dec 2006)
Log Message:
-----------
Add setBases mostly from descr_set__bases__ in typetype.py from pypy.
Add layoutAligns(PyType) to check if the actual structure of two types are
compatible and use in PyObject.setType to make sure the new type is acceptable.
Initialize mro to an empty array so __dict__ is usable from __new__ on
metatypes.
Modified Paths:
--------------
trunk/jython/Lib/test/test_descr.py
trunk/jython/src/org/python/core/PyObject.java
trunk/jython/src/org/python/core/PyType.java
trunk/jython/src/templates/type.expose
Modified: trunk/jython/Lib/test/test_descr.py
===================================================================
--- trunk/jython/Lib/test/test_descr.py 2006-12-09 21:00:01 UTC (rev 3018)
+++ trunk/jython/Lib/test/test_descr.py 2006-12-10 06:36:06 UTC (rev 3019)
@@ -3977,7 +3977,7 @@
testrmul,
testipow,
test_mutable_bases,
- #test_mutable_bases_with_failing_mro,
+ test_mutable_bases_with_failing_mro,
test_mutable_bases_catch_mro_conflict,
mutable_names,
subclass_right_op,
Modified: trunk/jython/src/org/python/core/PyObject.java
===================================================================
--- trunk/jython/src/org/python/core/PyObject.java 2006-12-09 21:00:01 UTC
(rev 3018)
+++ trunk/jython/src/org/python/core/PyObject.java 2006-12-10 06:36:06 UTC
(rev 3019)
@@ -395,10 +395,8 @@
}
public void setType(PyType type) {
- PyType objectType = PyType.fromClass(PyObject.class);
- if(PyObjectDerived.class.isAssignableFrom(getClass())
- && type.getStatic().equals(objectType) &&
- !type.equals(objectType)) {
+ if(getType().layoutAligns(type) &&
+ !type.equals(PyType.fromClass(PyObject.class))){
this.objtype = type;
} else {
throw Py.TypeError("Can only assign subtypes of object to
__class__ on subclasses of object");
Modified: trunk/jython/src/org/python/core/PyType.java
===================================================================
--- trunk/jython/src/org/python/core/PyType.java 2006-12-09 21:00:01 UTC
(rev 3018)
+++ trunk/jython/src/org/python/core/PyType.java 2006-12-10 06:36:06 UTC
(rev 3019)
@@ -24,7 +24,7 @@
dict.__setitem__("__dict__",new
PyGetSetDescr("__dict__",PyType.class,"getDict","setDict","delDict"));
dict.__setitem__("__name__",new
PyGetSetDescr("__name__",PyType.class,"fastGetName",null,null));
dict.__setitem__("__base__",new
PyGetSetDescr("__base__",PyType.class,"getBase",null,null));
- dict.__setitem__("__bases__",new
PyGetSetDescr("__bases__",PyType.class,"getBases",null,null));
+ dict.__setitem__("__bases__",new
PyGetSetDescr("__bases__",PyType.class,"getBases","setBases","delBases"));
dict.__setitem__("__mro__",new
PyGetSetDescr("__mro__",PyType.class,"getMro",null,null));
class exposed_mro extends PyBuiltinFunctionNarrow {
@@ -362,6 +362,29 @@
}
return cur;
}
+
+ /**
+ * Checks that the physical layout between this type and <code>other</code>
+ * are compatible.
+ */
+ public boolean layoutAligns(PyType other) {
+ return getLayout().equals(other.getLayout())
+ && needs_userdict == other.needs_userdict
+ && needs_finalizer == other.needs_finalizer;
+ }
+
+ /**
+ * Gets the most parent PyType that determines the layout of this type ie
+ * has slots or an underlying_class. Can by this PyType.
+ */
+ private PyType getLayout(){
+ if(underlying_class != null){
+ return this;
+ }else if(numSlots != base.numSlots){
+ return this;
+ }
+ return base.getLayout();
+ }
public PyObject getBase() {
if (base == null)
@@ -375,6 +398,96 @@
return new PyTuple(bases);
}
+ public void delBases() {
+ throw Py.TypeError("Can't delete __bases__ attribute");
+ }
+
+ public void setBases(PyObject newBasesTuple) {
+ if(!(newBasesTuple instanceof PyTuple)){
+ throw Py.TypeError("bases must be a tuple");
+ }
+ PyObject[] newBases = ((PyTuple)newBasesTuple).getArray();
+ if (newBases.length == 0) {
+ throw Py.TypeError("can only assign non-empty tuple to __bases__,
not " + newBasesTuple);
+ }
+ for(int i = 0; i < newBases.length; i++) {
+ if(!(newBases[i] instanceof PyType)){
+ if(!(newBases[i] instanceof PyClass)){
+ throw Py.TypeError(name + ".__bases__ must be a tuple of
old- or new-style classes, not " + newBases[i]);
+ }
+ }else{
+ if(((PyType)newBases[i]).isSubType(this)){
+ throw Py.TypeError("a __bases__ item causes an inheritance
cycle");
+ }
+ }
+ }
+ PyType newBase = best_base(newBases);
+ if(!newBase.layoutAligns(base)) {
+ throw Py.TypeError("'" + base + "' layout differs from '" + newBase
+ + "'");
+ }
+ PyObject[] savedBases = bases;
+ PyType savedBase = base;
+ PyObject[] savedMro = mro;
+ List savedSubMros = new ArrayList();
+ try {
+ bases = newBases;
+ base = newBase;
+ mro_internal();
+ mro_subclasses(savedSubMros);
+ for(int i = 0; i < savedBases.length; i++) {
+ if(savedBases[i] instanceof PyType) {
+ ((PyType)savedBases[i]).detachSubclass(this);
+ }
+ }
+ for(int i = 0; i < newBases.length; i++) {
+ if(newBases[i] instanceof PyType) {
+ ((PyType)newBases[i]).attachSubclass(this);
+ }
+ }
+ } catch(PyException t) {
+ for(Iterator it = savedSubMros.iterator(); it.hasNext(); ){
+ PyType subtype = (PyType)it.next();
+ PyObject[] subtypeSavedMro = (PyObject[])it.next();
+ subtype.mro = subtypeSavedMro;
+ }
+ bases = savedBases;
+ base = savedBase;
+ mro = savedMro;
+ throw t;
+ }
+
+ }
+
+ private void mro_internal() {
+ if(getType().underlying_class != PyType.class
+ && getType().lookup("mro") != null) {
+ mro = Py.make_array(getType().lookup("mro")
+ .__get__(null, getType())
+ .__call__(this));
+ }else{
+ mro = compute_mro();
+ }
+ }
+
+ /**
+ * Collects the subclasses and current mro of this type in
currentMroSaver. If
+ * this type has subclasses C and D, and D has a subclass E current mro
saver will equal
+ * [C, C.__mro__, D, D.__mro__, E, E.__mro__] after this call.
+ */
+ private void mro_subclasses(List mroCollector){
+ for (java.util.Iterator iter =subclasses.iterator(); iter.hasNext();) {
+ java.lang.ref.WeakReference type_ref =
(java.lang.ref.WeakReference)iter.next();
+ PyType subtype = (PyType)type_ref.get();
+ if (subtype == null)
+ continue;
+ mroCollector.add(subtype);
+ mroCollector.add(subtype.mro);
+ subtype.mro_internal();
+ subtype.mro_subclasses(mroCollector);
+ }
+ }
+
public PyObject instDict() {
if (needs_userdict) {
return new PyStringMap();
@@ -386,7 +499,7 @@
private PyType base;
private PyObject[] bases;
private PyObject dict;
- private PyObject[] mro;
+ private PyObject[] mro =